Add whitelistSourceRange of global config to location block in nginx template

This commit is contained in:
Bob Violier 2017-02-21 13:19:01 +01:00
parent 5ab0f284b0
commit 203a19c780

View file

@ -256,6 +256,12 @@ http {
{{ range $ip := $location.Whitelist.CIDR }} {{ range $ip := $location.Whitelist.CIDR }}
allow {{ $ip }};{{ end }} allow {{ $ip }};{{ end }}
deny all; deny all;
{{ else }}
{{ if gt (len $cfg.WhitelistSourceRange) 0 }}
{{ range $ip := $cfg.WhitelistSourceRange}}
allow {{ $ip }};{{ end }}
deny all;
{{ end }}
{{ end }} {{ end }}
port_in_redirect {{ if $location.UsePortInRedirects }}on{{ else }}off{{ end }}; port_in_redirect {{ if $location.UsePortInRedirects }}on{{ else }}off{{ end }};