Skip to content

Commit c00e2eb

Browse files
committed
Fix CORS on map-styles by skipping the www redirect
1 parent 3785d58 commit c00e2eb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

images/web/config/production.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
1818

1919
# Redirect to www openhistoricalmap.org
20+
# Skip /map-styles so the non-www host serves the files directly with their
21+
# CORS headers. A 301 redirect drops Access-Control-Allow-Origin, which breaks
22+
# cross-origin style fetches (e.g. the map-style minimaps).
2023
RewriteCond %{HTTP_HOST} =openhistoricalmap.org
2124
RewriteCond %{HTTP_HOST} !^www\. [NC]
25+
RewriteCond %{REQUEST_URI} !^/map-styles/
2226
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
2327

2428
<Location />

0 commit comments

Comments
 (0)