大网数据广告活动
网站运营与故障问答

Why is Chrome caching my login page?

· 52CE 我爱测

Our literacy web site for kids with disabilities is causing some users issues with logging in. You can visit the site at http://tarheelreader.org/ . If you login at https://tarheelreader.org/login/ , and then go to the login page…

问题原文

原帖链接 · GaryBishop · CC BY-SA 3.0

Our literacy web site for kids with disabilities is causing some users issues with logging in. You can visit the site at http://tarheelreader.org/. If you login at https://tarheelreader.org/login/, and then go to the login page again you should see a logout message. But Chrome caches the page and returns the original login page instead. The headers are:

Cache-Control:no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0
Content-Encoding:gzip
Content-Type:text/html; charset=UTF-8
Date:Thu, 26 Jan 2017 22:55:55 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Link:<https://tarheelreader.org/?p=110663>; rel=shortlink
Pragma:no-cache
Server:nginx
Vary:Accept-Encoding
X-UA_Compatible:IE=edge,chrome=1

Which are about every way I could find to say don't cache this page. But the network tab in the debugger shows the page coming from disk cache. If I disable the cache with the checkbox in the debugger things work as they should.

Update If I set the sandbox version of the site to use HTTPS only the problem goes away. Maybe it is something about the switching from HTTP to HTTPS and back?

社区高分解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

no-cache is not as strong as no-store. Chrome's documentation indicates that no-cache indicates a re-usable document, while no-store indicates that it should not be re-used.

Based on this information, your Cache-Control header should simply be:

Cache-Control: no-store

The extra values in it may be letting Chrome pick and choose which it would like to honor.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。