Apache proxy pass reverse for JAVA

apache-2.2reverse-proxy

I'm trying to configure apache as reverse prxy in front of JAVA jetty web server

Jetty runnig on local netwok on http://172.16.247.65:8091/gaapa/ my config

<VirtualHost *:80>
    ServerName beta.garantovanaplatba.cz
    ProxyPreserveHost On

    ProxyHTMLLogVerbose On
    LogLevel Info

    ServerAdmin milos.broulik@keyelements.org

    ServerAlias beta.gaapa.cz

    ProxyPass / http://172.16.247.65:8091/gaapa/
    ProxyPassReverse / http://172.16.247.65:8091/gaapa/

    #ProxyHTMLEnable On
    #ProxyHTMLInterp On

    ProxyHTMLInterp On
    ProxyHTMLURLMap /gaapa/ /

    RequestHeader unset Accept-Encoding

    ErrorLog /var/log/apache2/gaapa-beta-error_log
    CustomLog /var/log/apache2/gaapa-beta-access_log combined
    SetOutputFilter proxy-html

It's just that ProxyPassReverse aint working – I have one page redirecting after commiting POST – direct acces results in

302 FOUND with LOCATION http://172.16.247.65:8091/gaapa/action/3383380055511613440/show

while proxy acces results in

302 FOUND with LOCATION http://beta.garantovanaplatba.cz/gaapa/action/3383380055511613440/show

but there is no context path gaapa on proxy server (it resilts into /gaapa/gaapa/ access via proxy) – why the heck this doesn't work?

Best Answer

ProxyPreserveHost On --> Off

Jetty is creating redirect based upon this header, so it was beta.garantovanaplatba.cz directly from jetty and ProxyPassReverse couldn't match against it!

Related Topic