[GIS] Error with GeoExplorer/GeoServer and Apache Proxy Authentication

apacheboundless-suitegeoexplorergeoservertomcat

I use a customized version of the OpenGeo Suite Community Edition.
After everything was going well I now run into proxy timeouts.

First some details about the application architectur.

I work with the following components

All the geoserver services are protected and can only be accessed via authorization.

The access to the GeoExplorer is public.

I did not want that GeoExplorer users need a password to access the geoserver data. So I let GeoExplorer access Geoserver via the apache proxy who also authenticates to the Geoserver.

I access the GeoExplorer via the apache proxy.

There apache only forwards the request from port 80 to 8080 where tomcat is running.

server-IP\geoexplorer –> server-ip:8080\geoexplorer

Now GeoExplorer accesses Geoserver again via port 80 and apache proxy.

server-IP\geoserver –> server-ip:8080\geoserver

Before apache forwards the request to tomcat, it checks the referrer and if ok, adds the authentication information for Geoserver.

This works all fine for the first few minutes. Then I get the following Error from apache:

502 Proxy Error

The proxy server received an invalidresponse from an upstream server.

The proxy server could not handle the request GET /geoserver/ows.

Reason: Error reading from remote server

Here is the error log from apache

[Sun Sep 01 15:21:44 2013] [debug] mod_proxy_http.c(56): proxy: HTTP: canonicalising URL //server-ip:8080/geoserver/ows
[Sun Sep 01 15:21:44 2013] [debug] proxy_util.c(1494): [client 178.83.201.202] proxy: http: found worker http://server-ip:8080/geoserver for http://server-ip:8080/geoserver/ows?_dc=1378041704838&SERVICE=WMS, referer: http://server-ip/geoexplorer/composer/ 
[Sun Sep 01 15:21:44 2013] [debug] mod_proxy.c(998): Running scheme http handler (attempt 0)
[Sun Sep 01 15:21:44 2013] [debug] mod_proxy_ajp.c(651): proxy: AJP: declining URL http://server-ip:8080/geoserver/ows?_dc=1378041704838&SERVICE=WMS
[Sun Sep 01 15:21:44 2013] [debug] mod_proxy_http.c(1940): proxy: HTTP: serving URL http://server-ip:8080/geoserver/ows?_dc=1378041704838&SERVICE=WMS
[Sun Sep 01 15:21:44 2013] [debug] proxy_util.c(1999): proxy: HTTP: has acquired connection for (server-ip)
[Sun Sep 01 15:21:44 2013] [debug] proxy_util.c(2055): proxy: connecting http://server-ip:8080/geoserver/ows?_dc=1378041704838&SERVICE=WMS to server-ip:8080
[Sun Sep 01 15:21:44 2013] [debug] proxy_util.c(2153): proxy: connected /geoserver/ows?_dc=1378041704838&SERVICE=WMS to server-ip:8080
[Sun Sep 01 15:21:44 2013] [debug] proxy_util.c(2308): proxy: HTTP: fam 2 socket created to connect to server-ip
[Sun Sep 01 15:21:44 2013] [debug] proxy_util.c(2414): proxy: HTTP: connection complete to server-ip:8080 (server-ip)
[Sun Sep 01 15:22:04 2013] [error] [client 178.83.201.202] (70007)The timeout specified has expired: proxy: error reading status line from remote server server-ip, referer: http://server-ip/geoexplorer/composer/
[Sun Sep 01 15:22:04 2013] [debug] mod_proxy_http.c(1401): [client 178.83.201.202] proxy: read timeout, referer: http://server-ip/geoexplorer/composer/
[Sun Sep 01 15:22:04 2013] [error] [client 178.83.201.202] proxy: Error reading from remote server returned by /geoserver/ows, referer: http://server-ip/geoexplorer/composer/
[Sun Sep 01 15:22:04 2013] [debug] proxy_util.c(2017): proxy: HTTP: has released connection for (server-ip)
[Sun Sep 01 15:22:04 2013] [debug] mod_deflate.c(615): [client 178.83.201.202] Zlib: Compressed 483 to 323 : URL /geoserver/ows, referer: http://server-ip/geoexplorer/composer/

At this point geoserver is still running. I get a response on a GetMap request when I go via port 8080.

In the Tomcat Log I only get the last GetMap Request that was received by Geoserver.

I already tried to change the tomcat configuration. I raised the number of maxThread. This did not solve the problem.

Here is the configuration of my Connector:

<Connector port="8080" protocol="HTTP/1.1" address="server-ip"
               maxThreads="500" maxHttpHeaderSize="8192"
               enableLookups="false"
               acceptCount="200"
               connectionTimeout="20000"
               disableUploadTimeout="true" 
               URIEncoding="UTF-8"
               redirectPort="8443" />

What I understand and assume so far is the following:

There are two possibilities what the problem is caused by.

  • Tomcat is blocked by a hanging thread.
  • Geoserver blocks further requests from tomcat server because of some
    limitations.

Does anyone has a clue what the problem could be in my case?

Or where I should continue with my troubleshooting?

Thanks for further hints!!

Dominik

Best Answer

Had the same symptom on a non-Geoserver configuration (Apache, Tomcat though) the symptom and possible workarounds are discussed in this thread:

https://stackoverflow.com/questions/169453/bad-gateway-502-error-with-apache-mod-proxy-and-tomcat

If possible you need to quantify the delay and then what is causing it. Increasing timeout while maybe preventing the error should not be viewed as a solution.