4

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 '14 at 19:59
  • Sorry no, we ended up moving to nginx – Glenn Slaven Apr 3 '14 at 20:03
  • Did a bit more searching, and I found a solution. Will post for others. – aglassman Apr 3 '14 at 20:05
7

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>
2
  • 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 '14 at 20:09
  • This deserves a drink. – Dusan Bajic Apr 26 '16 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.