AmsalK
AmsalK

Reputation: 414

Leaflet.js Tiles over HTTPS

I'm trying to run leaflet.js with a server with SSL but get errors for the file fetch similar to the following:

GET https://tile.openstreetmap.org/12/1213/1481.png net::ERR_INSECURE_RESPONSE

There is a closed issue on Github that supposedly got solved by changing the request from

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

to

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'      
}).addTo(map);

However, even if I try navigating to the link https://tile.openstreetmap.org/12/1213/1481.png I get an error stating "NET::ERR_CERT_COMMON_NAME_INVALID".

Anyone found a solution to this?

Thanks!

Upvotes: 1

Views: 4562

Answers (1)

Remi
Remi

Reputation: 168

Try link in this form https://a.tile.openstreetmap.org/{z}/{x}/{y}.png, F1LT3R mentioned about it here: https://github.com/Leaflet/Leaflet/issues/3186

Upvotes: 5

Related Questions