Hello,
I need to add a Geoserver WMS Layer protected with Basic Authentication to a Geomap.
I tried adding a “custom option” (Authorization) using a custom WMSTileLayerLeafletLayerTranslator, but the option is added to the URL and not in the Header.
I’d like to do something like this:
var wmsLayer = L.TileLayer.wmsHeader(
'https://GEOSERVER_PATH/geoserver/wms?',
{
layers: 'YOUR_LAYER',
format: 'image/png',
transparent: true,
},
[
{
header: 'Authorization',
value: `Basic ${btoa(username + ':' + password)}`
},
],
null
).addTo(map);
How can achieve this?
Thanks in advance.
Regards,
Paolo