Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`304 Not Modified` for unconditional request

未关闭
#137 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
go
领域
backend

调研方向

从 issue 中的 Caddyfile 和 curl 复现开始,将第一次成功的响应与后续的 304 响应及其请求头进行比较。追踪 REQUEST-REVALIDATION 涉及的缓存和反向代理处理;当无条件请求不再意外收到 304 响应时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

In certain situations, the server responds with a 304 Not Modified status code for a request that lacks any specific conditions.

Reproduction steps:

{
    log
    cache {
        stale 3600s
    }
}

http://localhost:80 {
    log
    cache
    reverse_proxy http://localhost:82
}

http://localhost:82 {
    log
    header Cache-Control "max-age=1"
    file_server {
        root /data/caddy/
        index instance.uuid
    }
}
$ curl -i-H 'Cache-Control: max-stale=6' localhost:80
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=1
Cache-Status: Souin; fwd=uri-miss; stored; key=GET-http-localhost-/
Content-Length: 36
Date: Fri, 26 Dec 2025 12:28:54 GMT
Etag: "df7g3dt1b7k010"
Last-Modified: Thu, 25 Dec 2025 16:40:49 GMT
...

$ curl -i-H 'Cache-Control: max-stale=6' localhost:80
HTTP/1.1 304 Not Modified
Cache-Control: max-age=1
Cache-Status: Souin; fwd=request; fwd-status=304; key=GET-http-localhost-/; detail=REQUEST-REVALIDATION
Date: Fri, 26 Dec 2025 12:29:26 GMT
Etag: "df7g3dt1b7k010"
...
主要语言
Go
星标
396
派生
29
平均合并
32 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

caddyserver/cache-handler 的其他 Issue

查看 caddyserver/cache-handler 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。