Cache-Control示例:Cache-Control: max-age=3600, public作用:强制缓存1小时,允许代理/CDN缓存。Content-Encoding示例:Content-Encoding: gzip作用:启用Gzip压缩,减少传输体积。Strict-Transport-Security (HSTS)示例:Strict-Transport-Security: max-a
Cache-Control: no-cache 表示不缓存误区:很多人认为 no-cache 表示完全不缓存。事实:no-cache 允许缓存,但要求每次使用前必须向服务器验证(发送 If-None-Match 或 If-Modified-Since 请求)。真正禁止缓存的是 no-store。混淆 Expires 和 Cache-Control 优先级误区:认为 Expires 和 Cache-