1

I have web client on Apache and WFS service on Geoserver, both on same computer! Web client is (Apache) running on port 89, and Geoserver is running on 8181 port! I do following settings in Apache config file:

<Proxy *>
    Order Deny,Allow
    Deny from all
    Allow from `localhost
</Proxy>



 ProxyPass /geoserver http://localhost:8181/geoserver/web
    ProxyPassReverse /geoserver http://localhost:8181/geoserver/web`
<Location /geoserver>
    Order allow,deny
    Allow from all
</Location>

When I try to run client page I am getting error:

XMLHttpRequest cannot load http://localhost:8181/geoserver/wfs. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:89' is therefore not allowed access.

Are there any settings that I need to do in Geoserver to enable this?

3 Answers 3

1

The error is due to the fact you didn't included the line

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

into your Apache server proxy.cgi file.

See Configuring GeoServer Proxy for Public and Remote Data Access and you'll discover that your ProxyPass and ProxyPassReverse directives aren't properly configured, also (you didn't need the /web suffix).

7
  • I edit apache config file with this:ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /geoserver localhost:8181/geoserver ProxyPassReverse /geoserver localhost:8181/geoserver. And put following line in code OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=". After all this when I try to search WFS I am getting this message:XHR finished loading: "localhost:89/qgis-web-client-master/cgi-bin/…".
    – user238271
    Commented Jan 16, 2014 at 21:09
  • What did you see when you try to access localhost:89/geoserver/wms into your browser? Commented Jan 17, 2014 at 13:43
  • This is what I can see: <ows:ExceptionReport xmlns:ows="opengis.net/ows/1.1" xmlns:xsi="w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="opengis.net/ows/1.1 127.0.0.1:8080/geoserver/schemas/ows/1.1.0/owsAll.xsd"> <ows:Exception exceptionCode="MissingParameterValue" locator="request"> <ows:ExceptionText> Could not determine geoserver request from http request org.geoserver.monitor.MonitorServletRequest@1be51a </ows:ExceptionText> </ows:Exception> </ows:ExceptionReport>
    – user238271
    Commented Jan 17, 2014 at 18:20
  • From your log I can see GeoServer looks for the owsAll.xsd file in a GeoServer working on the (default) 8080 port. Your Proxy settings are for 8081 port. Now, please, check your tomcat/conf/server.xml Make sure you have set the 8091 port instead the default 8080. You must have <Connector port="8081" protocol="HTTP/1.1" connectionTimeout=.......... Commented Jan 17, 2014 at 18:55
  • I presume Apache Tomcat is your servlet container... Commented Jan 17, 2014 at 19:11
1

Try this for your proxy syntax

ProxyPass /geoserver/ http://localhost:8181/geoserver/
ProxyPassReverse /geoserver/ http://localhost:8181/geoserver/
0

Delete comment in httpd.conf line: mod_proxy.so and mod_proxy_http.so

This modules operate proxy. And of course restart Apache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.