Caching nginx auth_request

Solution 1:

Try upgrading NGINX.

I had the same problem with 1.14.0, where manual requests to /auth with curl were cached, but auth_request sub-requests were not.

After upgrading to NGINX 1.16.1 it started to work.

Solution 2:

I cannot leave comments because I'm new but the proxy_ignore_headers might help you.

proxy_ignore_headers Expires Cache-Control;

According to the Nginx docs; Disables processing of certain response header fields from the proxied server.

If your app server is returning any "no caching" instructions Nginx will honor them, by ignoring these headers any caching instructions are ignored.

Also, what is the cache status in the http response headers from Nginx at the clients machine. BYPASS will cause nginx to not cache it.

Again, sorry I can't leave a comment but I did want to help if I could.