Using A Proxy Script With Openlayers

THL Toolbox > Developers' Zone > Gis Development > Using A Proxy Script With Openlayers

Using a Proxy Script with OpenLayers

Contributor(s): Tom Benner

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:

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

More information on this, as well as an example CGI proxy file, can be found external link: here.

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.

Provided for unrestricted use by the external link: Tibetan and Himalayan Library