-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request headers? #4213
Comments
By default, image loading happens like this: You can override this behavior by calling The rest is up to you. Your custom loader might look something like this: function customLoader(tile, src) {
var client = new XMLHttpRequest();
client.open('GET', src);
client.setRequestHeader('foo', 'bar');
client.onload(function() {
var data = 'data:image/png;base64,' + btoa(unescape(encodeURIComponent(this.responseText));
tile.getImage().src = data;
});
client.send();
} |
Thanks! We'll initially be using this for WMS and WMS-C, so I'm guessing setImageLoadFunction() is what we'll need to override. |
Hi, is this actually working? Is there anything that i miss out? |
I open the issue again in #5401 |
This is one of the first links to show up in google searches, and doesn't seem to quite work 8 years later. So here is an updated answer that helped me: https://stackoverflow.com/a/50492340
|
How can I inject a http header into every map layer request?
In this case, I need to send an Authentication header for a given layer and source, but I may want to send other headers too.
The text was updated successfully, but these errors were encountered: