Reviewed & tested by the community
Project:
Leaflet
Version:
10.4.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Apr 2026 at 09:19 UTC
Updated:
16 Oct 2026 at 12:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
itamair commentedWell no, definitely DOES NOT look a Drupal Leaflet module BUG,
but something specifically related to your pages web server setup and requests to OpenstreetMap Tiles.
Probably your specific setup make your browser not sending HTTP Referer.
You should better set your settings and make sure you are complying with OpenstreetMap Tile Usage Policy: https://operations.osmfoundation.org/policies/tiles/
On the Drupal Leaflet module side all looks working fine.
I can’t reproduce the issue you report in some Drupal Leaflet module implementations that I manage, and that are still working fine on the OpenstreetMap tiles, as you can check by yourself:
Drupal Geofield - Leaflet map Demo site:
https://www.geodemocracy.com/drupal_geofield_stack_demo/web/geojson-map-...
Drupal Core: 11.3.4 - PHP: 8.3.30 - Drupal Leaflet: 10.4.4
(screenshot attached showing Referrer set in the HPP Request … )
Taranto-Viva website: https://www.taranto-viva.com
Drupal Core: 11.3.5 - PHP: 8.3.30 - Drupal Leaflet: 10.4.4
Just check and choose the Openstreetmap Layer from the Switcher on the top-right corner
(screenshot attached showing Referrer set in the HPP Request … )
The Way of GODS prototype: https://www.geodemocracy.com/via-degli-dei-2024/web/
Drupal Core: 11.3.5 - PHP: 8.3.30 - Drupal Leaflet: 10.2.43
Just check and choose the Openstreetmap Layer from the Switcher on the top-right corner
(screenshot attached showing Referrer set in the HPP Request … )
Just make sure you are correctly setting and requiring Openstreet Map Tiles layer so as described in the Drupal Leaflet module documentation:
https://git.drupalcode.org/project/leaflet#defining-a-custom-map--hook_l...
and make sure you are not making strange overrides/alters in your server setup Http Requests.
Comment #4
jonathan_hunt commentedfwiw, I had a site with this issue. It turns out I had
seckitmodule enabled with referrer policy set tosame-origin. Per advice at https://wiki.openstreetmap.org/wiki/Blocked_tiles#Referer_is_required setting theseckitreferrer policy toorigin-when-cross-originmeant referer header is sent and OSM is serving tiles ok.Comment #5
quentin massez commentedYou were right !!
That was a problem on my website configuration, i had referrer policy same-origin.
I changed it to origin-when-cross-origin and it works !
Thank you to both of you
Regards
Comment #6
michael.acampora commentedThere are security benefits of setting the referrer to something like same-origin, so would not recommend changing that. Leaflet has the option to set a referrer for retrieving the tiles. That way you only change the referrer for getting some tiles.
You can do something like this:
Comment #7
cezara commentedReopening this issue with a patch, as suggested in #6, but only for OpenStreetMap (OSM).
This patch adds a hook in js/leaflet.drupal.js that sets referrerPolicy: 'strict-origin-when-cross-origin' only for OSM tile servers (tile.openstreetmap.org). If a layer already has its own referrerPolicy, it remains unchanged.
This allows OSM to receive only the site's origin as the Referer, without sending the full URL. The approach is similar to the upstream Leaflet PR: https://github.com/Leaflet/Leaflet/pull/9883.
Tested on version 10.4.13 (Leaflet JS 1.9.4) with Referrer-Policy: same-origin.
Comment #8
grienauerI think it is good to have a global hardened referrer policy, and add only exceptions to it.
To not need to soften it globally, I like the patch on #comment-16808805 from cezara.
Would be great to get this into the module!
thank you!
Comment #9
grienauer