Add support for add_headers

This commit is contained in:
n1koo 2017-05-18 13:21:03 +03:00
parent c1e7c7a290
commit 02832dec6c
3 changed files with 26 additions and 2 deletions

View file

@ -3,6 +3,7 @@
{{ $healthzURI := .HealthzURI }}
{{ $backends := .Backends }}
{{ $proxyHeaders := .ProxySetHeaders }}
{{ $addHeaders := .AddHeaders }}
daemon off;
worker_processes {{ $cfg.WorkerProcesses }};
@ -92,6 +93,11 @@ http {
gzip_proxied any;
{{ end }}
# Custom headers for response
{{ range $k, $v := $addHeaders }}
add_header {{ $k }} "{{ $v }}";
{{ end }}
server_tokens {{ if $cfg.ShowServerTokens }}on{{ else }}off{{ end }};
# disable warnings
@ -324,6 +330,7 @@ http {
return 302 {{ $location.Redirect.AppRoot }};
}
{{ end }}
{{ if not (empty $authPath) }}
location = {{ $authPath }} {
internal;
@ -427,7 +434,7 @@ http {
# https://www.nginx.com/blog/mitigating-the-httpoxy-vulnerability-with-nginx/
proxy_set_header Proxy "";
# Custom headers
# Custom headers to proxied server
{{ range $k, $v := $proxyHeaders }}
proxy_set_header {{ $k }} "{{ $v }}";
{{ end }}