Skip to content

Commit 106bf86

Browse files
committed
Fix OpenStreetMap tiles
When rendering under http:// with Chrome, openstreetmap.org would redirect us to https://, and something about that caused Chrome to send different headers than if we went directly to https:// originally. Specifically, the Sec-CH-UA header would not be included, and it looks like openstreetmap's anti-abuse filters now treat a Chrome UA without Sec-CH-UA as suspicious (just guessing based on what I'm seeing). My user agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 My Sec-CH-UA: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"'
1 parent 98e55c7 commit 106bf86

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ leaflet 2.1.0.9000
44
BUG FIXES and IMPROVEMENTS
55
* The default marker icon for `addMarkers` no longer worked, due to the CDN we were relying on apparently being retired. Fixed by pointing to a new CDN. (#782)
66

7+
* New behavior from tile.openstreetmap.org caused `addTiles` default tileset to break when viewed under non-https protocol on recent versions of Chrome. Fixed by always using the https protocol to connect to openstreetmap. (#786)
8+
79
leaflet 2.1.0
810
--------------------------------------------------------------------------------
911

R/layers.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ groupOptions <- function(map, group, zoomLevels = NULL) {
152152
#' @export
153153
addTiles <- function(
154154
map,
155-
urlTemplate = "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
155+
urlTemplate = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
156156
attribution = NULL,
157157
layerId = NULL,
158158
group = NULL,
@@ -162,7 +162,7 @@ addTiles <- function(
162162
options$attribution <- attribution
163163
if (missing(urlTemplate) && is.null(options$attribution))
164164
options$attribution <- paste(
165-
"&copy; <a href=\"http://openstreetmap.org\">OpenStreetMap</a>",
165+
"&copy; <a href=\"https://openstreetmap.org\">OpenStreetMap</a>",
166166
"contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>"
167167
)
168168
invokeMethod(map, data, "addTiles", urlTemplate, layerId, group,

man/map-layers.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)