I’m caching Node server answers using Nginx proxy cache. Nginx returns a unique 502 page when that server is down. Things are going good so far…
Nginx continues to display the 502 page for five minutes after the Node server comes back online (my cache time). It makes no difference if I remove every file from the cache directory. Nginx breaks the cache and resumes serving real content if I restart it.
Is caching 502s by Nginx normal? Keep in mind that it is only storing the information that the server is unavailable, not a 502 response from the backend server.
How can I put a stop to this?
I modified my cache configuration from proxy cache valid any 5m to proxy cache valid 5m to resolve issue. Removing any suggests that you only wish to cache replies 200, 301, and 302.
All *_cache valid directives, such as uwsgi cache valid for uwsgi cache and fastcgi cache valid for fastcgi cache, have the same effect. Just making this relatively apparent fact clear to make it easier to find via web searches.
I find it interesting that a lack of answer would be stored although it seems evident that any response would be. Additionally, according to every piece of advise I’ve read on deleting the nginx cache, you may simply delete all the cache files. That is ineffective in this circumstance.
Please login or Register to submit your answer