Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't understand why we use proxy( OpenLayers.ProxyHost)for WMSGetFeatureInfo request in open layer. I am using open layer 2.10 ,apache-tomcat-6.0.35 and geoserver.

Why we use proxy? How should use?

I am new to web development. Thanks for help

share|improve this question

to avoid the cross origin policy that prevents evil sites from stealing your credit card details by accident. See for more details.

share|improve this answer
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. – GIS-Jonathan Apr 27 '12 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? – sacprasanna Apr 27 '12 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.


share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

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. – iant Aug 14 '12 at 9:07
@iant, I've expanded my answer with quotation from original article. – drnextgis Aug 14 '12 at 14:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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