Skip to content
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

osmWebWizard OpenLayers HTTP/HTTPS redirects refused by the map server #3991

Closed
jprk opened this issue Apr 13, 2018 · 1 comment
Closed

osmWebWizard OpenLayers HTTP/HTTPS redirects refused by the map server #3991

jprk opened this issue Apr 13, 2018 · 1 comment

Comments

@jprk
Copy link
Contributor

jprk commented Apr 13, 2018

Since some time ago I was experiencing problems running osmWebWizard in Chrome: The whole app started but it did not display any map tiles, all images were shown as inaccessible. Today I had a look using the developer mode and the console is full of the following error messages:

Redirect from 'http://b.tile.openstreetmap.org/16/35207/21492.png' to 'https://b.tile.openstreetmap.org/16/35207/21492.png' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.

CORS stands for Cross-Origin Resource Sharing and it seems that the tile server will not honour the redirect of http://... to https://... if the origin is not server by a server but it is coming from a file (the wizard page is displayed using file://...).

I have solved it by using the approach described in this StackExchange discussion, i.e. changing the code at

https://github.com/eclipse/sumo/blob/5b91df43ebe956661769e903b2da8f83e7665f60/tools/webWizard/script.js#L236

to

    // OSM map
    var map = new OpenLayers.Map("map");
    var maplayer = new OpenLayers.Layer.OSM(
    "OpenStreetMap", 
    // Official OSM tileset as forced HTTPS URLs
    [
        'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
        'https://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
        'https://c.tile.openstreetmap.org/${z}/${x}/${y}.png'
    ], 
    null);
    map.addLayer(maplayer);

I do not know yet if this is Windows/Chrome specific.

Jan

@namdre namdre closed this as completed in 3da7939 Apr 14, 2018
@namdre
Copy link
Contributor

namdre commented Apr 14, 2018

Thanks Jan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants