An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
You can set headers on any request made by the map, tiles and others. The trick is to use the maps transformRequest option. Here is an example of setting custom headers.
map = new atlas.Map('myMap', {
//Transform certain requests made by the map.
transformRequest: function (url, resourceType) {
//Check to see if a tile is being requested. If so, apply some sort of logic to check if the tile is related to the service request you want to modify.
if (resourceType === 'Tile' && url.startsWith('https://myTileServerDomain/path')) {
//Return the URL and custom header. Optionaly modify the URL if desired.
return {
url: url,
headers: { 'myCustomHeader': 'myCustomHeaderValue' }
};
}
//Return the URL if no changes.
return { url: url };
},
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: '<Your Azure Maps Key>'
}
});
Also, worth noting this same method can be used to modify requests, such as redirecting requests through a proxy service.