[Geoserver-users] using the geoserver map preview behind a reverse proxy

Hi there,

i'm having a small problem with the map preview page.. i access my
geoserver via a reverse proxy.. i.e. http://hostname:80/geoserver/
which apache proxies to http://localhost:8080/geoserver/ i use the
'proxy base url' parameter in the config to get the capabilities urls
to reflect the external hostname, but the map preview insists on
getting its images from localhost:8080.. which of course doesn't work
remotely.

Is there a config item i'm missing or is this a bug ? ideally it
should come from the same 'proxy base url' setting i think?

trying geoserver 1.7.1a, problem was there in 1.7.0 also.

cheers,

-i

It looks like you can add something to web.xml that fixes it. I'm not sure why we didn't hook it up to the proxy base url. See http://jira.codehaus.org/browse/GEOS-1918

Ivan Price wrote:

Hi there,

i'm having a small problem with the map preview page.. i access my
geoserver via a reverse proxy.. i.e. http://hostname:80/geoserver/
which apache proxies to http://localhost:8080/geoserver/ i use the
'proxy base url' parameter in the config to get the capabilities urls
to reflect the external hostname, but the map preview insists on
getting its images from localhost:8080.. which of course doesn't work
remotely.

Is there a config item i'm missing or is this a bug ? ideally it
should come from the same 'proxy base url' setting i think?

trying geoserver 1.7.1a, problem was there in 1.7.0 also.

cheers,

-i

------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Chris Holmes
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hey,

thanks Chris, but I think there is a problem with this.. when I enable
that parameter (no other changes to web.xml) and restart.. then visit:
http://localhost:8080/geoserver/openlayers/OpenLayers.js
(or a css page, or the same page using a url via the reverse proxy, as
the above is direct)

i get:

GeoServer - Exception
The following exception was thrown:

    * class java.lang.NullPointerException:

Details:

java.lang.NullPointerException
  at org.geoserver.filters.ReverseProxyFilter$CacheingResponseWrapper.getCachedContent(ReverseProxyFilter.java:315)
  at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:184)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
  at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
  at java.lang.Thread.run(Unknown Source)

so obviously the map preview is then broke. a request for a WMS png
(direct or via apache proxy) works fine, so i'm guessing its only the
content types that the filter is supposed to intercept that are
broken.

this is geoserver 1.7.1a

any ideas ?

-i

2009/1/3 Chris Holmes <cholmes@anonymised.com>:

It looks like you can add something to web.xml that fixes it. I'm not sure
why we didn't hook it up to the proxy base url. See
http://jira.codehaus.org/browse/GEOS-1918

Ivan Price wrote:

Hi there,

i'm having a small problem with the map preview page.. i access my
geoserver via a reverse proxy.. i.e. http://hostname:80/geoserver/
which apache proxies to http://localhost:8080/geoserver/ i use the
'proxy base url' parameter in the config to get the capabilities urls
to reflect the external hostname, but the map preview insists on
getting its images from localhost:8080.. which of course doesn't work
remotely.

Is there a config item i'm missing or is this a bug ? ideally it
should come from the same 'proxy base url' setting i think?

trying geoserver 1.7.1a, problem was there in 1.7.0 also.

cheers,

-i

------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Chris Holmes
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Ivan Price ha scritto:

Hey,

thanks Chris, but I think there is a problem with this.. when I enable
that parameter (no other changes to web.xml) and restart.. then visit:
http://localhost:8080/geoserver/openlayers/OpenLayers.js
(or a css page, or the same page using a url via the reverse proxy, as
the above is direct)

i get:

GeoServer - Exception
The following exception was thrown:

    * class java.lang.NullPointerException:

Details:

java.lang.NullPointerException
  at org.geoserver.filters.ReverseProxyFilter$CacheingResponseWrapper.getCachedContent(ReverseProxyFilter.java:315)
  at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:184)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
  at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
  at java.lang.Thread.run(Unknown Source)

so obviously the map preview is then broke. a request for a WMS png
(direct or via apache proxy) works fine, so i'm guessing its only the
content types that the filter is supposed to intercept that are
broken.

this is geoserver 1.7.1a

any ideas ?

Not really. Months ago we had a problem with proxies and discovered the
mechanism to deal with proxyBaseUrl would not work properly on html pages. Also, we found out that a properly set reverse proxy can already
deal with html pages on its own, without any GeoServer interverntion,
so the decision was to have only the OGC services be affected by the
proxyBaseUrl, since no proxy usually can alter on the fly only
html pages.

The filter was added as an afterthought, noticing how very often the
"reverse proxies" are not really setup to do proper html translation,
and we don't know if all of them can do it actually.

What you discovered is unfortunately a bug but I don't know exactly
what to do about it as I did not develop that code.
Gabriel, any heads up? It seems the cache field has never been
initialized?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime ha scritto:
...

Not really. Months ago we had a problem with proxies and discovered the
mechanism to deal with proxyBaseUrl would not work properly on html pages. Also, we found out that a properly set reverse proxy can already
deal with html pages on its own, without any GeoServer interverntion,
so the decision was to have only the OGC services be affected by the
proxyBaseUrl, since no proxy usually can alter on the fly only
html pages.

This was meant to be "since no proxy can usually alter xml responses,
they usually deal only with html pages".

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hey,

i think what you are expecting the proxy to do is part of
mod_proxy_html, not mod_proxy.

Mod proxy only translates the http headers (request and response),
mod_proxy_html does the content as well.

My understanding is that mod_proxy_html is not part of the default
(=binary) apache installation.. and it is certainly apache-specific..
for me asking the web server to inspect and translate all html and
javascript content is a bit hacky.. it seems like it would be cleaner
(and more portable?) to do this inside geoserver.. same as is the case
for the getcapabilities docs currently.

-i

2009/1/4 Andrea Aime <aaime@anonymised.com>:

Ivan Price ha scritto:

Hey,

thanks Chris, but I think there is a problem with this.. when I enable
that parameter (no other changes to web.xml) and restart.. then visit:
http://localhost:8080/geoserver/openlayers/OpenLayers.js
(or a css page, or the same page using a url via the reverse proxy, as
the above is direct)

i get:

GeoServer - Exception
The following exception was thrown:

   * class java.lang.NullPointerException:

Details:

java.lang.NullPointerException
       at
org.geoserver.filters.ReverseProxyFilter$CacheingResponseWrapper.getCachedContent(ReverseProxyFilter.java:315)
       at
org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:184)
       at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
       at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
       at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
       at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
       at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
       at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
       at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
       at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
       at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
       at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
       at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
       at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
       at java.lang.Thread.run(Unknown Source)

so obviously the map preview is then broke. a request for a WMS png
(direct or via apache proxy) works fine, so i'm guessing its only the
content types that the filter is supposed to intercept that are
broken.

this is geoserver 1.7.1a

any ideas ?

Not really. Months ago we had a problem with proxies and discovered the
mechanism to deal with proxyBaseUrl would not work properly on html pages.
Also, we found out that a properly set reverse proxy can already
deal with html pages on its own, without any GeoServer interverntion,
so the decision was to have only the OGC services be affected by the
proxyBaseUrl, since no proxy usually can alter on the fly only
html pages.

The filter was added as an afterthought, noticing how very often the
"reverse proxies" are not really setup to do proper html translation,
and we don't know if all of them can do it actually.

What you discovered is unfortunately a bug but I don't know exactly
what to do about it as I did not develop that code.
Gabriel, any heads up? It seems the cache field has never been
initialized?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

On Jan 3, 2009, at 3:30 AM, Ivan Price wrote:

i'm having a small problem with the map preview page.. i access my
geoserver via a reverse proxy.. i.e. http://hostname:80/geoserver/
which apache proxies to http://localhost:8080/geoserver/ i use the
'proxy base url' parameter in the config to get the capabilities urls
to reflect the external hostname, but the map preview insists on
getting its images from localhost:8080.. which of course doesn't work
remotely.

I have found that if I use mod_jk to with Apache in order to reverse proxy a JBoss or Tomcat hosting GeoServer, the GeoServer map preview page works correctly.

Initially, I used a mod_proxy ProxyPass/ProxyPassReverse directive pair, which caused the preview page to behave in the broken manner you describe.

Cheers,
Ryan