Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Revalidation of expired items in cache #181

Open
srikiraju opened this issue Oct 20, 2018 · 0 comments
Open

Feature request: Revalidation of expired items in cache #181

srikiraju opened this issue Oct 20, 2018 · 0 comments

Comments

@srikiraju
Copy link

srikiraju commented Oct 20, 2018

Hello,
I was looking for a specific type of behaviour in a cache system for nginx. Specially, I want this behaviour.

Request 1)

Web-client GET /foo
Nginx: Forward to origin
Response: 200, Etag: "baws", Cache-control: max-age:30, stale-while-response: 200000(or whatever)

Time passes. 35 seconds gone.
Request 2)
Web-client2 GET /foo
Nginx: Cache expired. Does a FULL request to origin to get the whole object. This does not include the "If-None-Match" validator. Returns 200, with Etag: baws"

What I expect
Web-client2 GET /foo
Nginx: Cache expired. Does a Conditional request to origin using If-None-Match. If it gets a 304 from origin, returns the whole thing with a 200 to client(since the client did not include an If-None-Match. Otherwise, it refreshes the cached version and returns that 200 to the origin. This is significantly more optimal (in my specific use case). Note that this means the upstream application isn't always computing the whole response.

This is extremely annoying since its forcing my origin to recompute something heavy.

BTW, Nginx totally does the thing I was want using the "proxy_cache_revalidate" feature, but I require a shared cache for my application.

Any idea on if this will be easy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant