Validation doesn't work
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- go
- 領域
- backend, performance
調査の方向性
まず Caddyfile の再現を実行し、2 つの curl コマンドによって行われる upstream リクエストを比較します。Go モジュール内のキャッシュ検証/再検証のエントリーポイントを追跡し、保存された Last-Modified メタデータが条件付きリクエストとして送信されることを確認します。完了の条件は、upstream が条件を受け取り、レスポンスの挙動が HTTP 検証と一致することです。
索引モデルが issue の本文から書いたものです。
説明
According to clause No. 4.3 of RFC 7234:
4.3. Validation
When a cache has one or more stored responses for a requested URI, but cannot serve any of them (e.g., because they are not fresh, or one cannot be selected; see Section 4.1), it can use the conditional request mechanism
...
This process is known as "validating" or "revalidating" the stored response.
4.3.1. Sending a Validation Request
When sending a conditional request for cache validation, a cache sends one or more precondition header fields containing validator metadata from its stored response(s), which is then compared by recipients to determine whether a stored response is equivalent to a current representation of the resource.
One such validator is the timestamp given in a Last-Modified header field...
Another validator is the entity-tag given in an ETag header field...
Thus, I expect caddy to cache the first response and subsequently validate cached data via a conditional request. However, caddy simply forwards a request to an upstream without any conditions.
I've tested it only with Last-Modified and no-cache, because of the bug I noticed with ETag. Additionally, I couldn't trigger revalidation using other directives like must-revalidate and stale-while-revalidate.
Reproduction steps:
{
log
cache {
stale 60s
}
}
http://localhost:80 {
log
cache
reverse_proxy http://localhost:81
}
http://localhost:81 {
log
header Last-Modified "Mon, 15 Dec 2025 08:52:20 GMT"
header Cache-Control "no-cache"
respond "Hello world"
}
$ curl -ik localhost:80
HTTP/1.1 200 OK
Cache-Control: no-cache
Cache-Status: Souin; fwd=uri-miss; stored; key=GET-http-localhost-/
Last-Modified: Mon, 15 Dec 2025 08:52:20 GMT
...
$ curl -ik localhost:80
HTTP/1.1 200 OK
Cache-Control: no-cache
Cache-Status: Souin; fwd=request; fwd-status=200; key=GET-http-localhost-/; detail=REQUEST-REVALIDATION
Last-Modified: Mon, 15 Dec 2025 08:52:20 GMT
...
logs:
{"level":"info","ts":1766736377.4338582,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"48850","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost","uri":"/","headers":{"X-Forwarded-Proto":["http"],"Accept-Encoding":["gzip"],"Accept":["*/*"],"Date":["Fri, 26 Dec 2025 08:06:17 UTC"],"Via":["1.1 Caddy"],"X-Forwarded-Host":["localhost"],"User-Agent":["curl/8.7.1"],"X-Forwarded-For":["172.16.249.1"]}},"bytes_read":0,"user_id":"","duration":0.000199667,"size":11,"status":200,"resp_headers":{"Content-Type":["text/plain; charset=utf-8"],"Server":["Caddy"],"Last-Modified":["Mon, 15 Dec 2025 08:52:20 GMT"],"Cache-Control":["no-cache"]}}
{"level":"info","ts":1766736377.4560177,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.16.249.1","remote_port":"57879","client_ip":"172.16.249.1","proto":"HTTP/1.1","method":"GET","host":"localhost","uri":"/","headers":{"User-Agent":["curl/8.7.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.023146958,"size":11,"status":200,"resp_headers":{"Last-Modified":["Mon, 15 Dec 2025 08:52:20 GMT"],"Server":["Caddy"],"Content-Length":["11"],"Via":["1.1 Caddy"],"Date":["Fri, 26 Dec 2025 08:06:17 GMT"],"Cache-Control":["no-cache"],"Content-Type":["text/plain; charset=utf-8"],"Cache-Status":["Souin; fwd=uri-miss; stored; key=GET-http-localhost-/"]}}
{"level":"info","ts":1766736406.6892934,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"48850","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost","uri":"/","headers":{"X-Forwarded-For":["172.16.249.1"],"X-Forwarded-Host":["localhost"],"X-Forwarded-Proto":["http"],"Accept":["*/*"],"Date":["Fri, 26 Dec 2025 08:06:46 UTC"],"Via":["1.1 Caddy"],"Accept-Encoding":["gzip"],"User-Agent":["curl/8.7.1"]}},"bytes_read":0,"user_id":"","duration":0.000023417,"size":11,"status":200,"resp_headers":{"Server":["Caddy"],"Last-Modified":["Mon, 15 Dec 2025 08:52:20 GMT"],"Cache-Control":["no-cache"],"Content-Type":["text/plain; charset=utf-8"]}}
{"level":"info","ts":1766736406.6932402,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.16.249.1","remote_port":"57892","client_ip":"172.16.249.1","proto":"HTTP/1.1","method":"GET","host":"localhost","uri":"/","headers":{"Accept":["*/*"],"User-Agent":["curl/8.7.1"]}},"bytes_read":0,"user_id":"","duration":0.019553791,"size":11,"status":200,"resp_headers":{"Content-Length":["11"],"Last-Modified":["Mon, 15 Dec 2025 08:52:20 GMT"],"Via":["1.1 Caddy"],"Cache-Control":["no-cache"],"Content-Type":["text/plain; charset=utf-8"],"Cache-Status":["Souin; fwd=request; fwd-status=200; key=GET-http-localhost-/; detail=REQUEST-REVALIDATION"],"Server":["Caddy"],"Date":["Fri, 26 Dec 2025 08:06:46 GMT"]}}
As we may see, the request made by caddy is not conditional.
- 主要言語
- Go
- スター
- 396
- フォーク
- 29
- 平均マージ
- 32分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
caddyserver/cache-handler のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
caddyserver/cache-handler#138 · コメント 1 件 · リアクション 3 件 ·
-
Admin API purge/invalidation still panics with nil pointer on v0.16.0 (same root cause as #140)オープン
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
caddyserver/cache-handler#143 · コメント 2 件 ·
-
Can not flush cacheオープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
caddyserver/cache-handler#140 · コメント 4 件 · リアクション 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
caddyserver/cache-handler#139 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
caddyserver/cache-handler#137 · コメント 1 件 ·
caddyserver/cache-handler の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/DebateAI#611 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MHSanaei/3x-ui#6737 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
terraform-provider
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
ClickHouse/terraform-provider-clickhousedbops#281 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
open-telemetry/opentelemetry-go-compile-instrumentation#1450 ·
メンテナーはふだん 2 日以内に返信