我使用带有mod_proxy 的Apache 2.2到某些 3rd 方 HTTP 服务器。
由于它不发送任何Cache-Control
标头,我想为响应代码 200 添加 1 天,为 404 添加 5 分钟,为任何其他响应代码添加 0。
所以我想:
SetEnvIf HttpResponseCode "200" rc_200
SetEnvIf HttpResponseCode "404" rc_404
Header set "Cache-Control" "private, max-age=0"
Header set "Cache-Control" "public, max-age=86400" env=rc_404
Header set "Cache-Control" "public, max-age=86400" env=rc_200
Run Code Online (Sandbox Code Playgroud)