Validation doesn't work
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- go
- Domínio
- backend, performance
Direção de pesquisa
Comece executando a reprodução do Caddyfile e comparando a solicitação upstream feita pelos dois comandos curl. Rastreie o ponto de entrada da validação/revalidação do cache no módulo Go e verifique se os metadados Last-Modified armazenados são enviados como uma solicitação condicional; está concluído quando o upstream recebe a condição e o comportamento da resposta corresponde à validação HTTP.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Go
- Estrelas
- 394
- Forks
- 30
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de caddyserver/cache-handler
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
caddyserver/cache-handler#138 · 1 comentário · 3 reações ·
-
Dificuldade 3/5 Meio dia Facilidade para iniciantes 45/100
caddyserver/cache-handler#146 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
caddyserver/cache-handler#145 ·
-
Admin API purge/invalidation still panics with nil pointer on v0.16.0 (same root cause as #140)Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 76/100
caddyserver/cache-handler#143 · 2 comentários ·
-
Can not flush cacheAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
caddyserver/cache-handler#140 · 4 comentários · 1 reação ·
Todas as issues de caddyserver/cache-handler
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
area/frontend/library-panels automated-triage type/bug type/ux
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
microsoft/azure-linux-image-tools#954 ·
Mantenedores costumam responder em até 1 dia
-
panic "time: missing Location in call to Time.In" on MySQL via aws_rds since v0.8.0Talvez já em andamento @tylertechgraves assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
open-policy-agent/opa-control-plane#452 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[bug bash] Actor logs are controlled by Kubernetes RBAC on the pool namespace, not atespace rolesAbertaarea/cli area/security bug-bash kind/docs
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 80/100
agent-substrate/substrate#3242 ·
Mantenedores costumam responder em até 1 dia