caddyserver / caddyserver/cache-handler

caddy ignores `no-cache` and serves cached response

Open
#135 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
393
Forks
28
Avg merge
32m
Merged PRs (30d)
1

Description

If a response contains ETag and Cache-Control with no-cache, caddy ignores no-cache and serves cached response with default ttl without validation.

Reproduction steps:

 {
     log
     cache
 }

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

 http://localhost:81 {
     log
     header ETag "\"3e25960a79dbc69b674cd4ec67a72c62\""
     header Cache-Control "no-cache"
     respond "Hello world"
 }
$ curl -i localhost:80
HTTP/1.1 200 OK
Cache-Control: no-cache
Cache-Status: Souin; fwd=uri-miss; stored; key=GET-http-localhost-/
....

$ curl -i localhost:80
HTTP/1.1 200 OK
Age: 11
Cache-Control: no-cache
Cache-Status: Souin; hit; ttl=109; key=GET-http-localhost-/; detail=DEFAULT
...
caddy version
v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8=

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied Caddyfile and comparing the two curl responses, focusing on the Cache-Control, Age, and Cache-Status headers. Trace the cache handling for an ETag response with no-cache; done means the response is validated rather than served with the default TTL.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.