diff --git a/inventory/group_vars/libravatar b/inventory/group_vars/libravatar index 9a651e4e53..cf65379d75 100644 --- a/inventory/group_vars/libravatar +++ b/inventory/group_vars/libravatar @@ -1,4 +1,5 @@ resolvconf: "resolv.conf/cloud" git_branch: master server_name: www.libravatar.org -server_alias: libravatar.org +server_alias: *.libravatar.org +server_redirect_name: "libravatar.org libravatar.com www.libravatar.com" diff --git a/inventory/group_vars/libravatar-stg b/inventory/group_vars/libravatar-stg index aa7c8bc985..1a398333c0 100644 --- a/inventory/group_vars/libravatar-stg +++ b/inventory/group_vars/libravatar-stg @@ -2,3 +2,4 @@ resolvconf: "resolv.conf/cloud" git_branch: devel server_name: libravatar-stg.fedorainfracloud.org server_alias: libravatar-stg.fedorainfracloud.org +server_redirect_name: libravatar-stg.fedorainfracloud.org diff --git a/roles/libravatar/templates/httpd/libravatar.conf b/roles/libravatar/templates/httpd/libravatar.conf index a0416d3eb6..0785343d0b 100644 --- a/roles/libravatar/templates/httpd/libravatar.conf +++ b/roles/libravatar/templates/httpd/libravatar.conf @@ -7,13 +7,14 @@ RewriteEngine on ServerName {{ server_name }} - ServerAlias {{ server_alias }} + ServerAlias {{ server_redirect_name }} {{ server_alias }} RewriteRule ^/\.well-known/(.*) /var/www/html/.well-known/$1 [L] RewriteRule "^/?(.*)" "https://{{ server_name }}/$1" [L,R=301,NE] ServerName {{ server_name }} + ServerAlias {{ server_alias }} SSLCertificateFile /etc/letsencrypt/live/{{ server_name }}/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/{{ server_name }}/privkey.pem @@ -59,7 +60,7 @@ RewriteEngine on SSLCertificateChainFile /etc/letsencrypt/live/{{ server_name }}/fullchain.pem Header always add Strict-Transport-Security "max-age=31536000; preload" - ServerAlias {{ server_alias }} + ServerAlias {{ server_redirect_name }} RewriteRule "^/?(.*)" "https://{{ server_name }}/$1" [L,R=301,NE]