From: Grant Slater Date: Fri, 11 Aug 2023 17:51:06 +0000 (+0100) Subject: civicrm: fix redirect to keep url X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/e228a690bd4e3cc25e354235294e065fd59a8e02 civicrm: fix redirect to keep url --- diff --git a/cookbooks/civicrm/recipes/default.rb b/cookbooks/civicrm/recipes/default.rb index 16947c9ef..f21f5fc6d 100644 --- a/cookbooks/civicrm/recipes/default.rb +++ b/cookbooks/civicrm/recipes/default.rb @@ -29,6 +29,8 @@ package %w[ php-intl ] +apache_module "rewrite" + cache_dir = Chef::Config[:file_cache_path] passwords = data_bag_item("civicrm", "passwords") diff --git a/cookbooks/civicrm/templates/default/apache.erb b/cookbooks/civicrm/templates/default/apache.erb index dd6112f12..727b0b913 100644 --- a/cookbooks/civicrm/templates/default/apache.erb +++ b/cookbooks/civicrm/templates/default/apache.erb @@ -13,17 +13,18 @@ ServerAdmin webmaster@openstreetmap.org + RewriteEngine on + <% if port == 80 -%> - RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/ - RedirectPermanent / https://supporting.openstreetmap.org/ + RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L] <% end -%> <% if port == 443 -%> SSLEngine on SSLCertificateFile /etc/ssl/certs/join.osmfoundation.org.pem SSLCertificateKeyFile /etc/ssl/private/join.osmfoundation.org.key +<% end -%> - RedirectMatch . https://supporting.openstreetmap.org/ - <% end -%> + RewriteRule ^/(.*)$ https://supporting.openstreetmap.org/$1 [R=permanent,L] CustomLog /var/log/apache2/join.osmfoundation.org-access.log combined ErrorLog /var/log/apache2/join.osmfoundation.org-error.log