nginx does not receive requests except for hard refresh

我怕爱的太早我们不能终老 提交于 2019-12-25 05:11:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!