From e3020b6d711efc146056ac0bae9ced374f084371 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Thu, 8 Sep 2022 15:43:54 +0200 Subject: [PATCH] :sparkles: Enable setup-http-site-proxy with missing proxy target If no proxy port is defined, only the dehydrated HTTP endpoint is created and the HTTPS endpoint returns 404. --- .../templates/apache-docker-proxy-site.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/setup-http-site-proxy/templates/apache-docker-proxy-site.j2 b/roles/setup-http-site-proxy/templates/apache-docker-proxy-site.j2 index 55dc711..022b0e2 100644 --- a/roles/setup-http-site-proxy/templates/apache-docker-proxy-site.j2 +++ b/roles/setup-http-site-proxy/templates/apache-docker-proxy-site.j2 @@ -39,6 +39,7 @@ SSLCertificateKeyFile {{dehydrated_certs_dir}/{{ site_name }}/privkey.pem SSLCertificateChainFile {{dehydrated_certs_dir}/{{ site_name }}/chain.pem +<% if proxy_port %> AllowEncodedSlashes NoDecode ProxyPass / http://{{ backend_host | default("localhost") }}:{{proxy_port}}/ nocanon RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} @@ -51,6 +52,9 @@ RewriteCond %{HTTP:Connection} upgrade [NC] RewriteRule ^/?(.*) "ws://{{ backend_host | default("localhost") }}:{{ proxy_port }}/$1" [P,L] +<% else %> + Redirect 404 / +< %endif %>