Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

Avoid cache on zero-bytes-returned?

$
0
0
I have a case where a user requires authorization to retrieve content.
Ngnix correctly returns the tomcat's 401, and then the user attempts
authentication.

However, if the user fails to authenticate, tomcat returns a 200 but
zero bytes returned. This comes through nginx as a cache-miss,
status=200, 0 bytes returned.

Unfortunately, if the user tries again, even if he/she is successful,
the 200 result is cached for my 10min cache setting for
200-results...thus, even a correct login will not return the content for
at least 10min due to the cached, zero-byte page.

Is there a way to leave my default caching enabled, but tell nginx to
NOT cache zero-byte results? If the correct content is available in the
cache, I want it returned without going to the back end, but in my case
(at least), a zero-byte result for a status=200 is not valid.

Thanks for any tips or tricks!
-AJ

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>