Referer

From OpenStreetMap Wiki
Jump to navigation Jump to search

If you have followed a hyperlink or URL to this page, you are using an application or webpage that we have automatically blocked for violating OpenStreetMap's tile usage policy.

If you are a user of the application/website

On a mobile or desktop application, please check if there is a new version of the application that fixes the map. Otherwise, if there are no updates yet, or if you are using a web application or website, please contact its author and let them know about the problem.

If you are the owner/a developer of the application/website

If the block mentions "Referer is required" then please ensure the HTTP Referer header is included with every tile request. For more details, see the MDN article covering this header.

In native application contexts, consult your map provider library's documentation, or set the Referer header yourself on requests you emit.

In web contexts existence of Referer in requests is controlled by the Referrer-Policy header generally, and by Request.referrerPolicy when using the Fetch JavaScript API.

For OpenStreetMap tile usage policy compliance, your Referrer-Policy should

  • Be one of: no-referrer-when-downgrade, origin, origin-when-cross-origin, strict-origin, strict-origin-when-cross-origin
  • Not be one of: no-referrer, same-origin

Library specifics

leaflet

For Leaflet versions released after May 2026, no additional steps are required. (Pull Request at https://github.com/Leaflet/Leaflet/pull/9897 to automatically set the referrer policy to strict-origin-when-cross-origin).

If you are using an older version of Leaflet, you should specify something like:

const attribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'

new L.TileLayer(osmUrl, {
  ....
  referrerPolicy: 'strict-origin-when-cross-origin',
  attribution: attribution
})

https://leafletjs.com/reference.html#tilelayer-referrerpolicy

If you are using Leaflet older than 1.8.0, you will need to update it first. Or change the Referrer-Policy for your website globally.

django-leaflet

There is a currently open Pull Request at https://github.com/makinacorpus/django-leaflet/pull/405 to automatically set the referrer policy to strict-origin when using the default layer.