From: Grant Slater Date: Fri, 7 Feb 2025 04:59:14 +0000 (+0000) Subject: community: fix the acme redirect templating madness X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/54d0b9bfa9c61573cd2d601052eede9de396d23d?ds=inline community: fix the acme redirect templating madness --- diff --git a/cookbooks/community/templates/default/web_only.yml.erb b/cookbooks/community/templates/default/web_only.yml.erb index 5382aebfe..cdced0a8a 100644 --- a/cookbooks/community/templates/default/web_only.yml.erb +++ b/cookbooks/community/templates/default/web_only.yml.erb @@ -116,14 +116,6 @@ hooks: cmd: - sudo -H -E -u discourse cp /shared/feeds/update-feeds.atom public/update-feeds.atom after_ssl: - - replace: - filename: "/etc/nginx/conf.d/discourse.conf" - from: /listen 80;/ - to: | - listen 80; - listen [::]:80; - rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent; - - replace: filename: "/etc/nginx/conf.d/discourse.conf" from: /add_header.+/ @@ -133,3 +125,11 @@ hooks: resolver <%= @resolvers.join(" ") %>; resolver_timeout 5s; ssl_dhparam /shared/ssl/dhparam.pem; + +run: + - replace: + filename: "/etc/nginx/conf.d/discourse.conf" + from: /return 301.+/ + to: | + rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent; + return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri;