We are using Nginx 1.10 to serve files in a production environment for a Django 1.7 backend and a Flask 0.10.1 frontend. Currently we have have the no-cache header set to prevent caching on error pages:

location /ohno/ {
    # Prevent caching on error pages.
    add_header Cache-Control "no-cache" always;
    try_files $uri/index.html $uri.html @flask;
    root {{ www_dir }}/{{ abc_server_name }}/apps/build/;

But I've heard that some people are intermittently having issues where a 502/503 Flask error page is mistakenly shown on their browser and even if they refresh or try again later the error page is still there. They have to delete cookies to access the site.

I thought the no-cache header prevented caching but cookies are still being saved and not removed when they shouldn't be. I went through the nginx and server logs with no luck and I'm unable to replicate the issue on our test environment.

Any ideas?


Cookies and cache are not the same thing, the no-cache has no influence on whether the browser should store cookies or not.

You could set cookies to expire though when you set them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.