How to Purge cach of 502 and 504's

tobydunst nginx-forum at
Wed Mar 19 14:41:39 UTC 2014

Hi All,

I am using nginx as a reverse proxy and have configured it to cache 502
using  proxy_cache_valid 502 30m; This is working fine, but my question is
how do I purge these from the cache if required?

There is no matching file in the proxy_cache_path to delete, so it appears
the Nginx caches these in memory. Restarting Nginx certainly clears these
cached results but I need to avoid restarting  as I have Websocket
connections I want to avoid dropping.

I can disable caching using proxy_no_cache and proxy_cache_bypass and
reload, then wait for the cached entries to time out. That seems to work but
I wanted to ask if there is a simple one hit solution to empty any cached

Kind Regards,


Posted at Nginx Forum:,248506,248506#msg-248506

More information about the nginx mailing list