How to clear NginX Reverse_proxy cache

You can also bypass/re-cache on a file by file basis using

proxy_cache_bypass $http_secret_header;

and as a bonus you can return this header to see if you got it from the cache (will return ‘HIT’) or from the content server (will return ‘BYPASS’).

add_header X-Cache-Status $upstream_cache_status;

to expire/refresh the cached file, use curl or any rest client to make a request to the cached page.

curl https://www.reck.dk/how-to-clear-ngi…erse_proxy-cache/ -s -I -H "secret-header:true"

this will return a fresh copy of the item and it will also replace what’s in cache

Skriv et svar