Disable NGINX cache based on cookies
For example .NET applications, using the default configuration, uses the cookie named .ASPXAUTH to track if the user is authenticated.
Something to remember that I’ve used on my post about emulation purge behaviour on nginx is the configuration proxy_cache_bypass, that has the following feature:
Note that the response from the back-end is still eligible for caching. Thus one way of refreshing an item in the cache is sending a request with a header you pick yourself …
So you MUST use proxy_no_cache to do this, using proxy_cache_bypass will cause the logged-in content to be cached and served to all users, and this is something that normally no one wants.
I have added one simple configuration snippet to show how it works: