rumaeagle
rumaeagle

Reputation: 31

trying to change cache headers on reverse_proxy

I'm trying to change the cache-control & Expires headers coming through an apache reverse_proxy. I can't change the origin server configs or code 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>

.. and

<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>

are not doing it & when restarting apache2 there are no complaints about the config.

Testing by using "curl -I ...image.jpg"

Upvotes: 3

Views: 1678

Answers (1)

user2821144
user2821144

Reputation: 121

Can maybe dodge the problem by setting multiple locations having different headers on each.

ex.

<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>

Upvotes: 1

Related Questions