[OpenLayers-Users] Using Proxy Host?

Ryan Williams rwilliams at paqinteractive.com
Thu Jun 3 11:10:59 EDT 2010


Hello all,
     I'd sent out a question earlier this week about using a proxy 
server with openlayers, so that I could make WMSGetFeatureInfo requests 
to a Geoserver WMS running on another domain.
I got a response here and another on the Geoserver users group that were 
both helpful and have the proxy working EXCEPT when i try to make a 
request on a layer that requires authentication.
Seems that the proxy.cgi isn't setup to handle a 401 response from the 
server. I've tried editing the python code in the proxy.cgi that comes 
with OpenLayers but haven't come up with a solution that will handle 
this 401 response from the server I'm using the proxy to get to.

Does anyone have a good example of  a proxy that handles 401 responses 
from the server?

By the time I make the WMSGetFeatureInfo request using the proxy, 
Geoserver has already asked the user for their credentials and Apache 
has asked the user for their credentials. I just need to know how to 
pass one of those credentials along to the proxy and include it in an 
Authorization: header

Thanks,
Ryan

"You can set up a cgi script that will proxy
(one comes with openlayers). You can then point OpenLayers.ProxyHost at
it. Keep in mind that the script does not ship as an open proxy (afaik)
so you would have to modify it to proxy for whatever host/domain your
GeoServer instance is on. - Justin Deoliveira"


On 6/1/2010 1:28 PM, Ryan Williams wrote:
> Sorry everyone, that should have gone to the users at geoserver.org instead
> of @openlayers....
> Thanks for you're response though, it is helpful
>
> Ryan
>
> On 6/1/2010 1:17 PM, christopher.schmidt at nokia.com wrote:
>    
>> On Jun 1, 2010, at 2:08 PM, ext Ryan Williams wrote:
>>
>>
>>      
>>> Hi all,
>>>
>>> I know similar questions have been asked, but after searching for most
>>> of the morning I have yet to find an answer that I can get to work.
>>>
>>> I'm trying to make this work: Geoserver 2.0-SNAPSHOT is on one server
>>> with it's own domain; Our web server is on a different server in a
>>> different domain.
>>> My page is html with OpenLayers 2.9 and other JavaScript and it is
>>> served up by the web server (call it dev.mapping.com/maps.html).
>>> I'm able to display map images and legends from Geoserver and
>>> GeoWebCache, but when I attempt a WMS GetFeatureInfo request I receive a
>>> blank popup and firefox reports: "401 Full Authentication is required to
>>> access this resource"
>>>
>>> Now, I think this is due to the 'Same Origin Policy' and I may be able
>>> to setup a proxy to get around this.
>>>
>>>        
>> This is incorrect. A 401 error is not issued because of a Same Origin Policy
>> violation. Instead, the request will simply not work/cause an error.
>>
>> Possibly, this is happening because the relative resource to dev.mapping.com
>> is actually protected: If you're requesting "/foo/wms/bar", and the URL
>> on dev.mapping.com is protected by some kind of auth, that could be your
>> problem, but without seeing your code I can't really imagine how this would
>> be without you knowing it.
>>
>>
>>      
>>> So, is this a situation where adding "dev.mapping.com" to the permitted
>>> hostnames in the Geoserver Proxy Administration UI should make this work?
>>>
>>>        
>> Generally, GeoServer would only be able to proxy requests *out* from
>> geoserver.example.com -- not requests from remote.example.com *to*
>> geoserver.example.com. So unless something special is going on here that
>> I can't picture, I don' think so.
>>
>>
>>      
>>> Do I need to be setting the OpenLayers.ProxyHost variable?
>>>
>>>        
>> Probably.
>>
>>
>>      
>>> (I realize
>>> this is an OpenLayers question)
>>> Is this something that needs to be setup on the web server instead?
>>>
>>>        
>> The web server that is serving your HTML pages, yes.
>>
>>
>>      
>>> I've tried adding the hostname to the permitted hostnames in the
>>> Geoserver UI and haven't seen any changes. Am I completely
>>> misunderstanding what this proxy config is for?
>>>
>>>        
>> I have never used GeoServer, but I think the answer is still yes.
>>
>> Regards,
>>
>>      
>    

-- 
Ryan Williams, GISP
GIS Analyst / Programmer
PAQ Interactive Inc.
107 S State St., Suite 300
Monticello, IL 61856-1968
Office: (217) 762-7955
Mobile: (217) 722-2794
rwilliams at paqinteractive.com




More information about the Users mailing list