[OpenLayers-Users] Setting / Configuring proxy in Openlayers/JavaScript

Marc Jansen jansen at terrestris.de
Wed Jan 27 05:00:46 EST 2010


Hi Job,

AFAIK the proxy set up using e.g.

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

Will be used for every AJAX request. Since WMS-Images aren't (usually) requested via XHR, these do not use the proxy. You could try to set the baseURL of your WMS-Layer to point to the proxy, though:

OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
var myWMSLayer = new OpenLayers.Layer.WMS(
  "WMS Name",  
  OpenLayers.ProxyHost + 'http://www.example.com/wmsserver?',
  {
    layers: 'humpty'
  }
);


That *could* work (it's untested)

Regards,
Marc


van de Sande, Job wrote:
>
> Hello,
>
> I was wondering if it was possible to set a proxy when using 
> OpenLayers. I know that, openlayer.ProxyHost can be used to point to a 
> cgi file. This will solve the problem when accessing data on the same 
> server.
>
> The thing is, i want to use a proxy server when connecting to a 
> WMS/WFS server from openLayers. It's not possible to use the proxy 
> settings from IE.
>
> So, any body knows a way to set a proxy server that only openlayers 
> will use, eq _http://localhost:8081_ as proxy server for openLayers.
>
> Met vriendelijke groeten / With kind regards,
>
>         Job van de Sande
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users





More information about the Users mailing list