6

I have an apache2.2 server with mod_proxy and mod_headers installed. On a request running with a ProxyPass directive, none of the Header set directives work, ie the header's aren't set in the response.

However if I remove the ProxyPass directive the headers are set. Is there some configuration that disables setting headers when using mod_proxy?

3
  • Did you ever find a solution to this issue? I'm running into the same problem.
    – aglassman
    Apr 3, 2014 at 19:59
  • Sorry no, we ended up moving to nginx Apr 3, 2014 at 20:03
  • Did a bit more searching, and I found a solution. Will post for others.
    – aglassman
    Apr 3, 2014 at 20:05

1 Answer 1

8

Despite the Apache mod_headers doc saying that it does not matter where the Header line goes, it apparently does. The only way I could get the header added was to put it in the same location scope as the proxy pass.

I initially had the proxy pass defined in the VirtualHost tag directly, but had to move it into the LocationMatch sub tag.

<LocationMatch "/myapp">
    ProxyPass http://1.1.1.1:8080/myapp disablereuse=On
    ProxyPassReverse http://1.1.1.1:8080/myapp
    Header add X-UA-Compatible "IE=7"
</LocationMatch>
3
  • I'm sure there is a logical reason for this. Someone with more depth of knowledge in the inner workings of Apache http may know why.
    – aglassman
    Apr 3, 2014 at 20:09
  • 1
    This deserves a drink. Apr 26, 2016 at 7:17
  • 1
    The ProxyPassReverse line in the example has three forward slashes after http: , but should only have two.
    – user117197
    Dec 2, 2021 at 2:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .