From 58fa98e466c9b59f9352240e86c6349eba21440e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 29 Dec 2020 18:41:12 +0000 Subject: [PATCH] Use virtual hosts to redirect osm.org for consistency --- .../web/templates/default/apache.frontend.erb | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/cookbooks/web/templates/default/apache.frontend.erb b/cookbooks/web/templates/default/apache.frontend.erb index f452b4fb3..19854189b 100644 --- a/cookbooks/web/templates/default/apache.frontend.erb +++ b/cookbooks/web/templates/default/apache.frontend.erb @@ -200,7 +200,7 @@ - ServerName openstreetmap.org + ServerName osm.org Header always set Cache-Control "max-age=31536000" Header always set Expires "Tue, 19 Jan 2038 03:14:07 GMT" @@ -210,12 +210,11 @@ RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L] RewriteCond %{REQUEST_URI} !^/server-status$ - RewriteRule ^(.*)$ https://openstreetmap.org$1 [L,NE,R=permanent] + RewriteRule ^(.*)$ https://osm.org$1 [L,NE,R=permanent] - ServerName www.openstreetmap.org - ServerAlias * + ServerName www.osm.org Header always set Cache-Control "max-age=31536000" Header always set Expires "Tue, 19 Jan 2038 03:14:07 GMT" @@ -224,15 +223,34 @@ 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] + RewriteRule ^(.*)$ https://www.osm.org$1 [L,NE,R=permanent] + + + + ServerName openstreetmap.org + + Header always set Cache-Control "max-age=31536000" + Header always set Expires "Tue, 19 Jan 2038 03:14:07 GMT" + + RewriteEngine on + + RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L] - # 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] + RewriteRule ^(.*)$ https://openstreetmap.org$1 [L,NE,R=permanent] + + + + ServerName www.openstreetmap.org + ServerAlias * + + Header always set Cache-Control "max-age=31536000" + Header always set Expires "Tue, 19 Jan 2038 03:14:07 GMT" + + RewriteEngine on + + RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L] RewriteCond %{REQUEST_URI} !^/server-status$ RewriteRule ^(.*)$ https://www.openstreetmap.org$1 [L,NE,R=permanent] -- 2.39.5