Using A Proxy Script With Openlayers
<h3 class="heading-h6"><a name="THLToolboxhomegtDevelopersZonegtGisDevelopmentgtUsingAProxyScriptWithOpenlayers" class="anchorpoint"></a><a href="/tools/wiki/home.html">THL Toolbox</a> > <a href="/tools/wiki/Developers%27%20Zone.html">Developers' Zone</a> > <a href="/tools/wiki/Gis%20Development.html">Gis Development</a> > Using A Proxy Script With Openlayers</h3><p class="paragraph">
</p><h3 class="heading-h1"><a name="UsingaProxyScriptwithOpenLayers" class="anchorpoint"></a>Using a Proxy Script with OpenLayers</h3><p class="paragraph"><strong class="bold">Contributor(s)</strong>: Tom Benner</p><p class="paragraph">Some of the tasks that OpenLayers performs (including WFS requests) require the use of a proxy script because of restrictions in JavaScript on the use of XMLHTTPRequest making requests to remote servers. To tell OpenLayers what script to use as its proxy host, make a declaration like: </p><div class="code"><pre>OpenLayers.ProxyHost = <span class="java-quote">"/cgi-bin/proxy.cgi?url="</span>;</pre></div><p class="paragraph">More information on this, as well as an example CGI proxy file, can be found <span class="nobr"><img src="/" alt="external link: " title="external link"/><a href="http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#WhydoIneedaProxyHost" target="rwikiexternal">here</a></span>.</p><p class="paragraph">If CGI execution isn't readily available, a simple PHP script can be written that takes a URL as a GET parameter and echoes the contents of that URL.
</p><h3 class="heading-h6"><a name="ProvidedforunrestrictedusebythespanclassnobrimgsrcsakairwikitoolimagesicklearrowgifaltexternallinktitleexternallinkahrefhttpwwwthliborgtargetrwikiexternalTibetanandHimalayanLibraryaspan" class="anchorpoint"></a><em class="italic">Provided for unrestricted use by the <span class="nobr"><img src="/" alt="external link: " title="external link"/><a href="http://www.thlib.org" target="rwikiexternal">Tibetan and Himalayan Library</a></span></em></h3>