2

I have been using apache's ProxyPass command to proxy

 http://localhost:8080/geoserver/ 

as follows:

    ProxyPass /geoserver http://localhost:8082/geoserver
    ProxyPassReverse /geoserver http://localhost:8082/geoserver

This works fine until I change the source path to

    ProxyPass /geoserver1 http://localhost:8082/geoserver
    ProxyPassReverse /geoserver1 http://localhost:8082/geoserver

When changed to above, If I go to

    http://localhost/geoserver1

in a browser, it will be redirected to

 http://localhost/geoserver 

automatically, without the port number. And then this gives an error of 404, address not found.

This happens if the source is anything other than /geoserver and the destination is

http://localhost:8082/geoserver

(I suspect this has something to do with the automatic redirect from

http://localhost:8082/geoserver

to

http://localhost:8082/geoserver/web

But I am not sure whether this is the case.

How do I fix it?

This is with GeoServer 2.5 in osgeo live 8

  • I see I have the same issue but it's not restricted to GeoServer, It appears to be Tomcat related. – nmtoken Oct 7 '16 at 12:33
3

The issue is to do with the Tomcat settings and not with any settings of GeoServer.

Note the Tomcat docs tell us:

It should be noted that it is not recommended to use a reverse proxy to change the context path because of the multiple issues it creates.

So if you want to run GeoServer under a different name you might consider changing the name of the GeoServer war file deployed, or changing the name in a context file, but if you really want to use the proxy settings the following worked for me:

In httpd.conf

ProxyRequests Off
ProxyPreserveHost On

<Proxy /gs/>
    Require all granted
</Proxy>
ProxyPass /gs/ ajp://127.0.0.1:8009/geoserv/
ProxyPassReverse /gs/ ajp://127.0.0.1:8009/geoserv/

In server.xml

<Context 
    path="/geoserv"
    docBase="C:\apps\geoserver\gs_2.9x"
    crossContext="true" 
    reloadable="false"
    <!-- having useRelativeRedirects set as true is the important bit! -->
    useRelativeRedirects="true"
/>
  • In my case, I'm not trying to change the name of the context, but to avoid having to specify it (http://geoserver.domain/ should be proxying to http://localhost:8080/geoserver/). I suspect that the problem is still the useRelativeRedirects setting. – Auspex Jun 12 '18 at 10:35

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.