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.
This commit is contained in:
Stefan Haun 2022-09-08 15:43:54 +02:00
parent c4af7754b2
commit e3020b6d71

View file

@ -39,6 +39,7 @@
SSLCertificateKeyFile {{dehydrated_certs_dir}/{{ site_name }}/privkey.pem SSLCertificateKeyFile {{dehydrated_certs_dir}/{{ site_name }}/privkey.pem
SSLCertificateChainFile {{dehydrated_certs_dir}/{{ site_name }}/chain.pem SSLCertificateChainFile {{dehydrated_certs_dir}/{{ site_name }}/chain.pem
<% if proxy_port %>
AllowEncodedSlashes NoDecode AllowEncodedSlashes NoDecode
ProxyPass / http://{{ backend_host | default("localhost") }}:{{proxy_port}}/ nocanon ProxyPass / http://{{ backend_host | default("localhost") }}:{{proxy_port}}/ nocanon
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
@ -51,6 +52,9 @@
RewriteCond %{HTTP:Connection} upgrade [NC] RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://{{ backend_host | default("localhost") }}:{{ proxy_port }}/$1" [P,L] RewriteRule ^/?(.*) "ws://{{ backend_host | default("localhost") }}:{{ proxy_port }}/$1" [P,L]
</ifmodule> </ifmodule>
<% else %>
Redirect 404 /
< %endif %>
</VirtualHost> </VirtualHost>
</IfFile> </IfFile>
</IfFile> </IfFile>