From cf2a19d4f045022ce3d2ee494145d57e7a2fe462 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Mon, 28 Dec 2020 20:09:39 +0000 Subject: [PATCH] Redirect fix for HSTS preloading of osm.org domain --- .../web/templates/default/apache.frontend.erb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cookbooks/web/templates/default/apache.frontend.erb b/cookbooks/web/templates/default/apache.frontend.erb index 9fbb7919d..f452b4fb3 100644 --- a/cookbooks/web/templates/default/apache.frontend.erb +++ b/cookbooks/web/templates/default/apache.frontend.erb @@ -176,13 +176,13 @@ RedirectPermanent /images/cc_button.png https://www.openstreetmap.org/assets/cc_button.png # - # Redirect api requests made to www.osm.org to api.osm.org + # Redirect api requests made to www.openstreetmap.org to api.openstreetmap.org # # RewriteCond %{HTTP_HOST} =www.openstreetmap.org # RewriteRule ^/api/(.*)$ https://api.openstreetmap.org/api/$1 [L,NE,R=permanent] # - # Redirect non-api requests made to api.osm.org to www.osm.org + # Redirect non-api requests made to api.openstreetmap.org to www.openstreetmap.org # RewriteCond %{HTTP_HOST} =api.openstreetmap.org RewriteCond %{REQUEST_URI} !^/api/ @@ -224,6 +224,16 @@ RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L] + # HSTS Preloading requires domain name match + RewriteCond %{HTTP_HOST} =osm.org + RewriteCond %{REQUEST_URI} !^/server-status$ + RewriteRule ^(.*)$ https://osm.org$1 [L,NE,R=permanent] + + # HSTS Preloading requires domain match + RewriteCond %{HTTP_HOST} =www.osm.org + RewriteCond %{REQUEST_URI} !^/server-status$ + RewriteRule ^(.*)$ https://www.osm.org$1 [L,NE,R=permanent] + RewriteCond %{REQUEST_URI} !^/server-status$ RewriteRule ^(.*)$ https://www.openstreetmap.org$1 [L,NE,R=permanent] -- 2.39.5