Basic authorization headers

Hi!

Is it possible to add basic authorization headers to each request to GeoServer (WMS layers)? And, if yes, how it can be handled?

Thanks in advance!

You need to use a Resource to specify the URL instead of a string. I don’t have a server to test the following, but I think it is the right approach.

var provider = new Cesium.WebMapServiceImageryProvider({

url : new Cesium.Resource({

    url: 'https://YourServerHere.com/...',

    headers: {

        'Authorization': 'Basic Base64UsernamePasswordGoesHere'

    }

}),

layers : '0',

proxy: new Cesium.DefaultProxy('/proxy/')

});

viewer.imageryLayers.addImageryProvider(provider);

``

Hi Scott,

Yes, it's works perfect! Thank you very much!