I have a web map application in my local machine(windows xp and dont have IIS) and I have postgis data in Geoserver on Tomcat (Ubuntu). To get the WMSgetfeatureInfo, I have configured the proxy.cgi file in Geoserver (usr/lip/cgi-bin/proxy.cgi) and added my local ip address in

allowedHosts = ['xxx.xxx.x.xxx', 'www.openlayers.org', 'openlayers.org', 'labs.metacarta.com', 'world.freemap.in', 'prototype.openmnnd.org', 'geo.openplans.org', 'sigma.openplans.org', 'demo.opengeo.org', 'www.openstreetmap.org', 'sample.azavea.com', 'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080', 'vmap0.tiles.osgeo.org','www.openrouteservice.org']

and added the below line in my script.

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

but it throws an error in chrome console:

GET localhost:3890/usr/lib/cgi-bin/….…T%3D‌​application%252Fvnd.ogc.gml%26SRS%3DEPSG%253A27700%26X%3D682%26Y%3D284 404 (Not Found) 

I dont know whether its right or wrong. Proxy.cgi should be copied in Geoserver or my machine? in which path? added my IP into allowedhosts is correct?

Please anyone suggest me to fix this issue


2 Answers 2


If your openlayers app is on the same domain and port of GeoServer you don't need a proxy.

It's not working because proxy.cgi is a piece of code that works on a web server (Apache, Cherokee, nginx,...). So it's not a Java application like GeoServer that runs on a servlet container (Tomcat, Jetty,...), they are completely different technologies.

One typical use case is to have a web server with your web map application and a reverse proxy with your geoserver or any other web map server so all your requests to http://yourserver.org/geoserver are proxied to http://yourserver.org:8080/geoserver. In that case, as all your requests are at the same domain (yourserver) and port (80, the default) again you don't need a proxy.

  • Hi jorge, I am very new to this.. could you please provide step by step procedure? I have developed web application using asp.net on winXP but I have to use WMSgetfeatureInfo from Geoserver on Tomcat6 (Ubuntu).
    – venkat
    Sep 26, 2013 at 10:41
  • OK so you have probably an IIS web server for your web app and your GeoServer is behind it on a different machine. We
    – Jorge Sanz
    Sep 27, 2013 at 6:29
  • OK so you have probably an IIS web server for your web app and your GeoServer is behind it on a different machine. It's long to explain here and there are many resources to look for that before asking here. What you need is to configure a reverse proxy on IIS to your GeoServer. Another approach we use here at the office is to install the IIS URL Rewrite Module. Here you have an screenshot of a rule to redirect requests to a Spanish national SDI server. Hope it helps
    – Jorge Sanz
    Sep 27, 2013 at 6:37

You should just comment out "OpenLayers.ProxyHost=" while testing the Web page on your local machine if you are loading the page directly to a browser on a local machine.

This will let you load the map layers.

However, this will not let you allow using some secondary requests like click to send a WMSGetFeatureInfo to a remote map server.

The OpenLayers examples are meant to be served from a Web server in order to work properly.

cgi is not for Tomcat. It is for Apache Web Server and the likes.

If you want to use Tomcat, you need to serve the Web page on a Tomcat on your machine and install ProxyServlet on the Tomcat (e.g., http://wiki.apache.org/tomcat/ServletProxy).

If you want to develop on the Web page at the same time, run Tomcat from e.g., Eclipse IDE.

And then,

var proxyProtocol = window.location.protocol;
var proxyHost = window.location.host;
OpenLayers.ProxyHost = proxyProtocol + "//" + proxyHost + "/yourproxyservletURL";

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.