问题原文
原帖链接 · LeonidMew · CC BY-SA 4.0
I'm implementing caching at the server application level, because my hosting doesn't provide Apache caching modules and it's not possible to use a reverse proxy there. Its cheap and fast hosting, so I don't want to change it.
Can I detect when the user presses F5 or Ctrl+F5, instead clicking on link to one page? I'm quite sure there are some special HTTP headers generated on request like this. Without it, the page will be always served from cache.
已采纳解答
原帖链接 · LeonidMew · CC BY-SA 4.0
Browsers do send additional headers, but behavior different. This info in link a bit outdated: stackoverflow question
Looks like Cache-control:no-cache is the best solution, to check for Ctrl+F5, but better to check not the only one header.
Just checked on Firefox Ubuntu, F5 gives nothing, but Ctrl+F5 request contain this
Pragma no-cache
Cache-Control no-cache
Checked Chromium - same behavior, same two headers.
This headers may pass any proxy in the middle, and come to end - site server, as I known.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
