I can't understand why we use proxy (OpenLayers.ProxyHost) for WMS GetFeatureInfo request in OpenLayers. I am using OpenLayers 2.10, Apache-Tomcat-6.0.35 and GeoServer.

Why we use proxy? How should use?

I am new to web development.

2 Answers 2


to avoid the cross origin policy that prevents evil sites from stealing your credit card details by accident. See http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#WhydoIneedaProxyHost for more details.

  • This. Many browsers stop cross-site scripts from running so you have to "cheat" and use a javascript proxy. It's hacky, but it works. Commented Apr 27, 2012 at 10:24
  • I can run tomcat using localhost:8080 and geoserver using localhost:8080/geoserver.So both in 8080 port.Should i need this porxy setting? Commented Apr 27, 2012 at 16:29

Due to security restrictions in Javascript, it is not possible to retrieve information from remote domains via an XMLHttpRequest.

Classes like WFS and GeoRSS use XMLHTTPRequest to get their data. If they are querying a remote server (anything other than the machine hosting your page), you must install a proxy script somewhere web accessible on that machine. See below for how to set up your own ProxyHost.

If the OpenLayers.ProxyHost variable is not set to a valid proxy host, requests are sent directly to the remote servers. In most cases, the result will be a security exception, although this exception often occurs silently.


  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
    – Ian Turton
    Commented Aug 14, 2012 at 9:07
  • 1
    @iant, I've expanded my answer with quotation from original article.
    – drnextgis
    Commented Aug 14, 2012 at 14:45

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.