ol-mapbox-style
ol-mapbox-style copied to clipboard
CORS - Credential issue
Hi,
I saw that 'same-origin' is used for the credentials when fetching the style. Shouldn't this be parametrable ? So we could call olms giving that parameter.
In my case, i need to set "include", but i cannot.
What do you think ?
Thank you for the work.
For the style, you can pass an object instead of a url. Then you could do something like
fetch(styleUrl, {credentials: 'include'}).then(response => {
response.json().then(style => {
olms('map', style);
});
});
@ahocevar I don't think it will work, because "same-origin" is also hard coded in the applyStyle function. And that one cannot be avoided i think.
We could either expose a global fetch options object, or you could use a fetch wrapper as additional entry point in your webpack config. If you prefer the former, we'd appreciate a pull request.
@ahocevar For the moment, i found a solution just by configuring my nginx in a better way. But i keep that ticket in mind. Thank you for you time.