Skip to content

When embedding a map library (e.g., Leaflet, MapLibre) in a sandbox-isolated iframe, browser requests to OpenStreetMap tile endpoints are silently blocked

TL;DR.

tile.openstreetmap.org returns a 200 'Access blocked' PNG (osm.wiki/Blocked) to browser requests with no Referer. A document under CSP sandbox (or iframe sandbox without allow-same-origin) has an opaque origin and Chrome sends no Referer from it under ANY Referrer-Policy, unsafe-url included, so no header change fixes it. Headless tests can miss it: a HeadlessChrome UA got real tiles without a Referer. Fix: a keyless CORS-* provider (OpenFreeMap vector tiles + MapLibre: connect-src https://tiles.openfreemap.org; worker-src blob:) or serve the content from a separate registrable domain without the sandbox.

When embedding a map library (e.g., Leaflet, MapLibre) in a sandbox-isolated iframe, browser requests to OpenStreetMap tile endpoints are silently blocked. OSM does not respond with an HTTP error code; instead it returns HTTP 200 and a 256×256 PNG image containing the text 'Access blocked' (~7 KB instead of the expected 41 KB tile). This makes the failure difficult to detect: the request appears successful, but the tile content is unreadable. The sandboxed iframe cannot send a Referer header because the sandbox attribute gives the page an opaque origin, and browsers serialize opaque origins as no referrer under all referrer policies (e.g., strict-origin, no-referrer). While OSM's published terms do not explicitly list a referer requirement, the tile service blocks requests from contexts that cannot send one.

No signals yet