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

Marc Jansen jansen at terrestris.de
Wed Jan 27 05:39:26 EST 2010


Hey Job,

I don't know if I understand you correctly but...

If you serve your OL-application through port 80, you cannot access 
resources from another port through AJAX.

Your proxy has to have the same origin as the request-sender has, 
otherwise your browser should (and usually will) throw an error.

If you want to have everything requested through your 8081-port-proxy, 
but your application runs on port 80, the only way I see is to use a 
proxy that runs on port 80 and talks to your proxy on 8081, which in the 
end requests stuff and gives it back to your proxy on port 80, which 
will give it back to OpenLayers. Sounds like overkill to me.

I do not understand the part about IE / your proxy crashing every now 
and then.

Regards,
Marc



JobvdSande wrote:
> Hi Marc,
>
> Thank you for your reply. I know indeed that this is one way of setting up a
> proxy in OpenLayers, to avoid the same origin policy (or something, not sure
> atm).
>
> The problem actuality is, we have a proxy running on eq localhost:8081, this
> proxy will rap the request into a soap message. That's why i want also
> openlayers to use this proxy.
>
> One other way, what is not working, is to set IE to this very same proxy,
> but then our proxy crashes because every request made by any windows
> application is routed trough our proxy, was of course, is not its
> intention..
>
> Hopefully it is posible to do this either in openlayers or javascript.
>
>
> Marc Jansen-2 wrote:
>   
>> 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
>>>       
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>>     
>
>   





More information about the Users mailing list