I am playing around a bit with Leaflet and run into an issue.

I am using the OSM tile service https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png.

But I get CORS problem when I zoom in closer than level 19. Why do I get it only if I zoom closer than 19? Up to 18, it works fine. Shouldn't I get CORS issues on all zoom layers if it's truly a CORS problem?

Full error message

Access to Image at 'https://a.tile.openstreetmap.org/20/554563/283403.png' from origin 'http://localhost:4321' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4321' is therefore not allowed access. The response had HTTP status code 404.

  • Could you post the exact error message? Ideally from different browsers. Sep 24, 2018 at 22:08
  • 2
    I added the full error message. Maybe its simply a limitation on the tile service?
    – geogrow
    Sep 25, 2018 at 6:33

1 Answer 1


Read the message!

No 'Access-Control-Allow-Origin' header is present on the requested resource.

The response had HTTP status code 404.

You got a "404 Not Found" error from the tile server because openstreetmap.org does not serve tiles on levels higher than 19.

openstreetmap.org does not include a "Access-Control-Allow-Origin" header when returning a 404.

Thus your browser refuses to use the content of the error response any further.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.