[OpenLayers-Dev] Headers in WMS Layer

Moises Arcos marcos at emergya.com
Fri Apr 4 02:52:15 PDT 2014


Thanks for the answer.

I have been trying your way and it doesn't work, I get a status code 200
but a white image on map.

I don't know what more to do, any suggestion?

Regards!!!

2014-04-04 11:37 GMT+02:00 Andreas Hocevar <ahocevar at boundlessgeo.com>:

> This will not work. WMS requests in OpenLayers are pure image
> requests, handled by the browser. But it looks like what you want is
> plain HTTP Basic authentication, which is supported by all browsers.
> So you could just change your layer_url to:
>
> http://user:pass@rest_of_your_url/wms/
>
> I'm sure I do not need to tell you that doing this is equivalent to
> sharing credentials with the whole world.
>
> Andreas.
>
> On Fri, Apr 4, 2014 at 11:30 AM, Moises Arcos <marcos at emergya.com> wrote:
> > Hi developers,
> >
> > I am using OpenLayers 2.11 to display WMS Layers, but I need any help,
> > because I am trying to pass authorization headers into a WMS request,
> but I
> > don't know if it's possible.
> >
> > The request that I sent is:
> >
> > var layer = new OpenLayers.Layer.WMS(
> > layerData.name,
> > layer_url,
> > {
> > layers: layers
> > },
> > {
> >     headers: {
> >                      'Authorization': 'Basic user:pass'
> >       }
> > }
> > );
> >
> > I know that the better options to do this is throught a proxy, but I
> need to
> > do this temporaly.
> >
> > Regards!!!
> >
> > --
> > Moisés Arcos Santiago
> > Área de Proyectos
> >
> > Emergya Consultoría
> > Tfno: +34 954 51 75 77
> > Fax: +34 954 51 64 73
> > www.emergya.es
> >
> > _______________________________________________
> > Dev mailing list
> > Dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
>
>
> --
> Andreas Hocevar
> Geospatial Solutions Engineer | Boundless
> ahocevar at boundlessgeo.com
> @boundlessgeo
>



-- 
Moisés Arcos Santiago
Área de Proyectos

Emergya Consultoría
Tfno: +34 954 51 75 77
Fax: +34 954 51 64 73
www.emergya.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20140404/8427d375/attachment.html>


More information about the Dev mailing list