1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-06-30 22:05:46 +00:00

feat: define basic auth for virtual path

This commit is contained in:
jmformenti
2024-02-10 16:24:00 +01:00
committed by Nicolas Duchon
parent df890def7c
commit fa23c11edb
2 changed files with 7 additions and 1 deletions

View File

@ -275,7 +275,10 @@
set $upstream_keepalive {{ if ne $keepalive "disabled" }}true{{ else }}false{{ end }};
{{- end }}
{{- if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }}
{{- if (exists (printf "/etc/nginx/htpasswd/%s_%s" .Host (sha1 .Path) )) }}
auth_basic "Restricted {{ .Host }}/{{ .Path }}";
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s_%s" .Host (sha1 .Path)) }};
{{- else if (exists (printf "/etc/nginx/htpasswd/%s" .Host)) }}
auth_basic "Restricted {{ .Host }}";
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" .Host) }};
{{- end }}