大网数据广告活动
服务器运维问答

How is Cache-Control: max-age affected by intermediate caching?

· 52CE 我爱测

I am currently serving an HTML page to users with a Cache-Control: max-age=600 header. I believe this allows the users' browsers to cache the page for a maximum of 10 minutes. I am considering adding a CDN in front of my server w…

问题原文

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

I am currently serving an HTML page to users with a Cache-Control: max-age=600 header. I believe this allows the users' browsers to cache the page for a maximum of 10 minutes.

I am considering adding a CDN in front of my server which, due to the above header, should also cache the page for a maximum of 10 minutes.

If a user obtains the page when it has been in the CDN cache for 9 minutes, say, will it still be cached in the browser for 10 minutes, giving a total cached time of 19 minutes? Or will it only be cached in the browser for 1 minute?

已采纳解答

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

Read this excellent article on cache control headers.

One idea is instead of specifying a ten minute caching time you can generate the page to include a precise date/time it expires. After that date/time any client will re-validate the resource. If you specify ten minutes you could potentially end up with 10 minutes on the CDN and 10 minutes on the client. So the solution could be to change it to 5 minutes, but this will increase server load and response time.

However I think Michael's answer of "it could be anything" is probably the best answer you'll get to your precise question. You will need to do some testing with your particular CDN.

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

资料来源与适用范围

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

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

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