Search code examples
apachetomcatproxyopenlayersgeoserver

Proxying Apache with 8081 port to Geoserver 8080 for WFS


I've been in a dilemma for several days and now I'd really appreciate your help. Here is my situation: - Ubuntu Linux (All ports opened) - Apache running on port 8081 - Geoserver Tomcat on port 8080 I'm trying to make a WFS connection by a different pc than the server so I need to use a proxy. In my server I edited httpd.conf and added these lines:

ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /geoserver http://mydomain.com:8080/geoserver
ProxyPassReverse /geoserver http://mydomain.com:8080/geoserver

I downloaded proxy.cgi from OpenLayers and edited to add my allowed hosts (localhost:8081, localhost, mydomain:8081, etc.) When I open proxy.cgi in the web browser I'm forwarded to the openlayers site, so I think that python and the script are running correctly. Then I added http://mydomain.com:8081/geoserver to the base proxy URL in geoserver dashboard. In my html I point every script file like Openlayers.js, GeoExt,js to apache so with port 8081. Inside my init function I put:

OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

and the vector layer with WFS is like this:

var inc2007 = new OpenLayers.Layer.Vector("Inc", {
                                          styleMap: styles1,
       strategies: [new OpenLayers.Strategy.BBOX()],
         protocol: new OpenLayers.Protocol.WFS({
             url: "http://mydomain.com:8081/geoserver/wfs",
                                                  featurePrexif: "Inc",
                                                  featureType: "Inc",
             featureNS: "http://mydomain.com:8080/Incendi"

                                        }),
    });

I can't see this layer on the map and firebug doesn't log anything. I tried to change the ProxyHost link to "http://mydomain.com:8081/cgi-bin/proxy.cgi?url=" but nothing. What can I do? I really...really need your help.

Thanks in advance for your replies


Solution

  • Solved by putting proxy.cgi on the local apache and not on the apache residing on the geoserver machine...