Welcome! Log In Create A New Profile

Advanced

How to remove cache entry when cache-control changes to no-cache?

Posted by MasterMike 
How to remove cache entry when cache-control changes to no-cache?
January 16, 2020 05:47AM
Hi guys,
I have a certain use case that I cannot solve and I hope you can help me.

What the problem looks like:
Step 1) nginx correctly caches a static page for 1 minute with this header: cache-control: max-age=60, public
Step 2) now I change the page to be a dynamic page that should not be cached anymore and send this header: cache-control: no-cache
Step 3) nginx keeps delivering the old, cached page as a stale page instead of the fresh, dynamic page

What the config looks like (most important lines):
proxy_cache_use_stale updating error timeout http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
proxy_cache_revalidate on;

What probably happens:
Nginx tries to update the stale page in the background.
But as it receives a page which says "cache-control: no-cache", it keeps delivering the old, stale content.

What the solution should probably do:
Purge the old cache entry and deliver the fresh, dynamic page.


Any ideas how to achieve this?

Thanks a lot,
Michael
Re: How to remove cache entry when cache-control changes to no-cache?
January 23, 2020 02:51AM
Any ideas?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready