Enabled caching in nginx:

location ~* ^.+\.(js|css|png)$ { expires max; } 

Everything is working. Then there was a problem: unauthorized users on the site redirects to the main page, and after logging in, the user gets access to all pages. The strangest thing is that the browser (Chrome, if it matters) caches the redirection header. As a result, when I try to open that very page, I see status code 302 Moved Temporarily (from cache) . The same happens with successfully loaded pages - status code for some 200 ok (from cache) . How to force the browser to cache only js, css and png, but not to cache pages?

  • To begin with, show the entire nginx config, as well as all the headers that are sent from the server when unauthorized users are redirected - Alexey Ten
  • @AlexeyTen imagine the most banal nginx config - this is my config. - devtwo
  • I will not represent anything. I ask to show your config. - Alexey Ten
  • @AlexeyTen is good, here are all pastebin.com/gPX8VVwb configs, but pastebin.com/L1mxTKr8 headers - devtwo
  • Look for these headers in your PHP scripts. There is nothing in nginx. - Alexey Ten

0