问题
When doing a tail -f /var/log/nginx/access.log
I notice the following things:
- when a user is on any page, and hits Enter from the address bar, no request is received by
nginx
, the browser directly loads from its cache instead - when a user performs a hard refresh (F5 on Windows, Cmd+R on Mac),
nginx
did receive a request - when a user visits
/login
which then redirects to/
,nginx
does indeed receive the request for/login
but not for/
, so the browser renders/
from its cache, ignoring the fact that the user has been logged in since
Put it simply, the browsers doesn't send any request at all for already visited pages, except for hard refreshes performed by the user.
How could I make sure nginx
receives all requests, since pages are dynamically generated and, for instance, home page content changes depending on the state of the user?
Using nginx 1.9.3
on digital ocean
's Ubuntu 15.10 x64
with http
回答1:
Adding expires 0;
to nginx.conf
in http { }
did the trick.
来源:https://stackoverflow.com/questions/36748206/nginx-does-not-receive-requests-except-for-hard-refresh