1

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.

5

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. – 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
0

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.

ProxyHost

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

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.