[OpenLayers-Users] send cross-site credentials to a secure WMS via OL

Christopher Schmidt crschmidt at metacarta.com
Fri Aug 29 13:26:00 EDT 2008


On Fri, Aug 29, 2008 at 05:02:15PM +0200, Carolin Wengerter wrote:
> Hello,
> 
> I've got a secure WMS (apache, basic authentication) and I want to
> include the credentials in the http-header. How could I do this? Or is
> there another way to send the credentials to the server via OL?
> 
> I tried with OpenLayers.Request, but it only works for one domain and
> I have to do a cross-site request.
> 
> My index.html is at localhost.
> This is the WMS-Layer:
> wms_auth = new OpenLayers.Layer.WMS( "WMS Auth" ,
> "http://wms-server/...", {layers: 'tk', format: 'image/jpeg',
> srs:'EPSG:31468', version:'1.1.1'});

Essentially, "You can't." 

OpenLayers requests images via <img src=""> requests. This will fall
back to the browser's default auth mechanism -- prompting the user --
but does not allow for the setting of additional request headers. There
is no support in OpenLayers for requesting images in any other way, and
doing so would be a significant development effort which no one has yet
expressed an interest in. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list