【问题标题】:trying to change cache headers on reverse_proxy尝试更改 reverse_proxy 上的缓存标头
【发布时间】:2013-05-01 20:13:33
【问题描述】:

我正在尝试更改来自 apache reverse_proxy 的缓存控制和过期标头。我无法更改原始服务器配置或代码 ATM。

 ExpiresActive On
  Header unset Etag
  Header unset Cache-Control
  Header unset Expires
  <LocationMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=290304000, public"
  </LocationMatch>

.. 和

<LocationMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresActive On
Header unset Etag
Header unset Cache-Control
Header unset Expires
Header set Cache-Control "public"
  Header set Cache-Control "max-age=290304000, public"
</LocationMatch>

没有这样做,并且在重新启动 apache2 时没有关于配置的投诉。

使用“curl -I ...image.jpg”进行测试

【问题讨论】:

    标签: apache2 reverse-proxy image-caching


    【解决方案1】:

    可以通过设置多个位置在每个位置上具有不同的标题来规避问题。

    例如

    <Location /resources/>
      Header unset Etag
      Header set Cache-Control "max-age=290304000, public"
      Header unset Expires
      ProxyPass {ajp|http}://host:port/resources/
      ProxyPassReverse {ajp|http}://host:port/resources/
    </Location>
    <Location //>
      Header add "Instance_1"
      ProxyPass {ajp|http}://host:port/
      ProxyPassReverse {ajp|http}://host:port/
    </Location>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 2012-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-12
      相关资源
      最近更新 更多