<div dir="ltr">Thanks for the answer.<div><br></div><div>I have been trying your way and it doesn't work, I get a status code 200 but a white image on map.</div><div><br></div><div>I don't know what more to do, any suggestion?<br>
</div><div><br></div><div>Regards!!!</div><div><div class="gmail_extra"><br><div class="gmail_quote">2014-04-04 11:37 GMT+02:00 Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@boundlessgeo.com" target="_blank">ahocevar@boundlessgeo.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">This will not work. WMS requests in OpenLayers are pure image<br>

requests, handled by the browser. But it looks like what you want is<br>
plain HTTP Basic authentication, which is supported by all browsers.<br>
So you could just change your layer_url to:<br>
<br>
http://user:pass@rest_of_your_url/wms/<br>
<br>
I'm sure I do not need to tell you that doing this is equivalent to<br>
sharing credentials with the whole world.<br>
<br>
Andreas.<br>
<div><div class="h5"><br>
On Fri, Apr 4, 2014 at 11:30 AM, Moises Arcos <<a href="mailto:marcos@emergya.com">marcos@emergya.com</a>> wrote:<br>
> Hi developers,<br>
><br>
> I am using OpenLayers 2.11 to display WMS Layers, but I need any help,<br>
> because I am trying to pass authorization headers into a WMS request, but I<br>
> don't know if it's possible.<br>
><br>
> The request that I sent is:<br>
><br>
> var layer = new OpenLayers.Layer.WMS(<br>
> layerData.name,<br>
> layer_url,<br>
> {<br>
> layers: layers<br>
> },<br>
> {<br>
>     headers: {<br>
>                      'Authorization': 'Basic user:pass'<br>
>       }<br>
> }<br>
> );<br>
><br>
> I know that the better options to do this is throught a proxy, but I need to<br>
> do this temporaly.<br>
><br>
> Regards!!!<br>
><br>
> --<br>
> Moisés Arcos Santiago<br>
> Área de Proyectos<br>
><br>
> Emergya Consultoría<br>
> Tfno: <a href="tel:%2B34%20954%2051%2075%2077" value="+34954517577">+34 954 51 75 77</a><br>
> Fax: <a href="tel:%2B34%20954%2051%2064%2073" value="+34954516473">+34 954 51 64 73</a><br>
> <a href="http://www.emergya.es" target="_blank">www.emergya.es</a><br>
><br>
</div></div>> _______________________________________________<br>
> Dev mailing list<br>
> <a href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
<span class=""><font color="#888888"><br>
<br>
<br>
--<br>
Andreas Hocevar<br>
Geospatial Solutions Engineer | Boundless<br>
<a href="mailto:ahocevar@boundlessgeo.com">ahocevar@boundlessgeo.com</a><br>
@boundlessgeo<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div style="color:rgb(136,136,136)">Moisés Arcos Santiago</div><div style="color:rgb(136,136,136)">Área de Proyectos</div><div style="color:rgb(136,136,136)">
 </div><div style="color:rgb(136,136,136)">Emergya Consultoría</div><div style="color:rgb(136,136,136)">Tfno: <a value="+34954517577" style="color:rgb(17,85,204)">+34 954 51 75 77</a></div><div style="color:rgb(136,136,136)">
Fax: <a value="+34954516473" style="color:rgb(17,85,204)">+34 954 51 64 73</a></div><div style="color:rgb(136,136,136)"><a href="http://www.emergya.es/" style="color:rgb(17,85,204)" target="_blank">www.emergya.es</a></div>

</div></div></div>