From 66f7f2b79822814764594da8cbd3b991d71e3fdc Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Sun, 26 Oct 2025 15:44:47 +0000 Subject: [PATCH] community: Add acme redirect test --- cookbooks/community/recipes/default.rb | 2 +- .../community/templates/default/web_only.yml.erb | 14 ++++++-------- test/integration/community/inspec/http_spec.rb | 7 +++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cookbooks/community/recipes/default.rb b/cookbooks/community/recipes/default.rb index 83616c655..0262531d4 100644 --- a/cookbooks/community/recipes/default.rb +++ b/cookbooks/community/recipes/default.rb @@ -63,7 +63,7 @@ git "/srv/community.openstreetmap.org/docker" do action :sync repository "https://github.com/discourse/discourse_docker.git" # DANGER launch wrapper automatically updates git repo if rebuild method used: https://github.com/discourse/discourse_docker/blob/107ffb40fe8b1ea40e00814468db974a4f3f8e8f/launcher#L799 - revision "b81256c5f1fc1b43ffc52f492cb2935ba9825a2c" + revision "45b2526a548951ead7f73bfb15c95798a94b2d0d" user "root" group "root" notifies :run, "notify_group[discourse_container_new_data]" diff --git a/cookbooks/community/templates/default/web_only.yml.erb b/cookbooks/community/templates/default/web_only.yml.erb index e28920471..21bd5a7b9 100644 --- a/cookbooks/community/templates/default/web_only.yml.erb +++ b/cookbooks/community/templates/default/web_only.yml.erb @@ -123,11 +123,9 @@ hooks: resolver <%= @resolvers.join(" ") %>; resolver_timeout 5s; ssl_dhparam /shared/ssl/dhparam.pem; - -run: - - replace: - filename: "/etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf" - from: /listen 80;/ - to: | - listen 80; - rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent; + - replace: + filename: "/etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf" + from: /listen 80;/ + to: | + listen 80; + rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent; diff --git a/test/integration/community/inspec/http_spec.rb b/test/integration/community/inspec/http_spec.rb index e5e0677e9..77f4080c9 100644 --- a/test/integration/community/inspec/http_spec.rb +++ b/test/integration/community/inspec/http_spec.rb @@ -7,3 +7,10 @@ describe port(443) do it { should be_listening } its("protocols") { should cmp %w[tcp tcp6] } end + +describe http("http://localhost/.well-known/acme-challenge/abc", + :headers => { "Host" => "community.openstreetmap.org" }, + allow_redirects: false) do + its("status") { should cmp 301 } + its("headers.Location") { should cmp %r{^http://acme\.openstreetmap\.org/} } +end -- 2.39.5