feat: Add user customizable default root response

This commit is contained in:
Alexander Lieret authored and Nicolas Duchon committed 2022-02-24 15:08:15 +01:00
1 parent 28c73e5b52
commit 9df330e51e
6 files changed
+53 -2

No files matched your search

+11
View File
@@ -5,6 +5,7 @@
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
{{ $debug_all := $.Env.DEBUG }}
{{ $sha1_upstream_name := parseBool (coalesce $.Env.SHA1_UPSTREAM_NAME "false") }}
{{ $default_root_response := coalesce $.Env.DEFAULT_ROOT "404" }}
{{ define "ssl_policy" }}
{{ if eq .ssl_policy "Mozilla-Modern" }}
@@ -392,6 +393,11 @@ server {
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
{{ template "location" (dict "Path" $path "Proto" $proto "Upstream" $upstream "Host" $host "Vhostroot" $vhost_root) }}
{{ end }}
{{ if (not (contains $paths "/")) }}
location / {
return {{ $default_root_response }};
}
{{ end }}
{{ end }}
}
@@ -429,6 +435,11 @@ server {
{{ $upstream := printf "%s-%s" $upstream_name $sum }}
{{ template "location" (dict "Path" $path "Proto" $proto "Upstream" $upstream "Host" $host "Vhostroot" $vhost_root) }}
{{ end }}
{{ if (not (contains $paths "/")) }}
location / {
return {{ $default_root_response }};
}
{{ end }}
{{ end }}
}