mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-06-30 22:05:46 +00:00
feat: Add user customizable default root response
This commit is contained in:
committed by
Nicolas Duchon
parent
28c73e5b52
commit
9df330e51e
11
nginx.tmpl
11
nginx.tmpl
@ -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 }}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user