This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to embed a map with activated Content-Security-Policy?

1

Hi,

i try to embed a OSM Map via the Share Option on openstreetmap.org If i enable CSP on my Server, the Map will not be loaded. My problem is: I can't figure out which Policies are needed so that https://www.openstreetmap.org/export/embed.html will be loaded on my site. I already tried "frame-src 'self' openstreetmap.org; img-src 'self' *.tile.openstreetmap.org" and also "script-src 'self' openstreetmap.org" but nothing helped.

Could someone tell me the correct settings soi can use OSM Maps and activate CSP?

Kind regard

Tapsiturtle

asked 05 Nov '14, 09:37

Tapsiturtle's gravatar image

Tapsiturtle
56115
accept rate: 0%


One Answer:

2

After trying a bit around it seems that this is helping in .htaccess: Header set Content-Security-Policy "default-src 'self'; frame-src www.openstreetmap.org; style-src 'self'; script-src 'self' www.openstreetmap.org;"

answered 24 Nov '14, 08:21

Tapsiturtle's gravatar image

Tapsiturtle
56115
accept rate: 0%

edited 25 Nov '14, 12:14

Source code available on GitHub .