I have had a site go down a few times and setup uptime checks for it thinking that it would help me know when it was down so I could do a redeploy or server setup run which seemed to fix.
It happened again this morning but my uptime checker was saying the site was fine. In chrome the site was giving a 502 but it was working on FF and other computers and phones.
I closed up/quit chrome and reopened and the site worked so this was a local caching issue.
I did some digging and found the below at: https://stackoverflow.com/questions/28994863/nginx-proxy-cache-caches-502-errors
Is the default Trellis settings for all pages to be cached including error pages? Can someone help with the commands to stop the caching of 502 errors?
I managed to figure this out myself. Nginx really does cache the knowledge that the upstream server is inaccessible. To fix this I changed my cache config from `proxy_cache_valid any 5m;` to `proxy_cache_valid 5m;` Removing `any` implies you only want to cache 200, 301, and 302 responses. [share](https://stackoverflow.com/a/28995889)[improve this answer](https://stackoverflow.com/posts/28995889/edit) answered Mar 11 '15 at 19:41
* The same applies to all `*_cache_valid` directives, including `uwsgi_cache_valid` for `uwsgi_cache` , and `fastcgi_cache_valid` for `fastcgi_cache` . Just clarifying this somewhat already-obvious point for ease of discovery via web searches. – [davidjb](https://stackoverflow.com/users/1048705/davidjb) [Mar 16 '15 at 2:41](https://stackoverflow.com/questions/28994863/nginx-proxy-cache-caches-502-errors#comment46372999_28995889)