I'm using Nginx proxy_cache to cache responses from a Node server. When that server is offline Nginx returns a custom 502 page. All going well so far...
When the Node server comes back online Nginx keeps returning the 502 page for 5 mins (my cache time). If I delete all the files in the cache dir it makes no difference. If I restart Nginx it busts the cache and starts serving real content again.
Is it normal for Nginx to cache 502s? Note that it's not caching a 502 response from the backend server it's caching the fact that the server isn't accessible.
What can I do to stop this?