ingress: adds configurable SSL redirect nginx controller

* add global value to config map
* add per ingress value as annotation to ingress resources
This commit is contained in:
Christian Simon 2016-06-05 15:19:55 +01:00
parent 08a05db93c
commit 3ae80fd3cc
6 changed files with 91 additions and 29 deletions

View file

@ -172,10 +172,6 @@ http {
{{- end }}
{{ if (and $server.SSL $cfg.hsts) -}}
if ($scheme = http) {
return 301 https://$host$request_uri;
}
more_set_headers "Strict-Transport-Security: max-age={{ $cfg.hstsMaxAge }}{{ if $cfg.hstsIncludeSubdomains }}; includeSubDomains{{ end }}; preload";
{{- end }}
@ -184,6 +180,12 @@ http {
{{- range $location := $server.Locations }}
{{ $path := buildLocation $location }}
location {{ $path }} {
{{ if (and $server.SSL $location.Redirect.SSLRedirect) -}}
# enforce ssl on server side
if ($scheme = http) {
return 301 https://$host$request_uri;
}
{{- end }}
{{/* if the location contains a rate limit annotation, create one */}}
{{ $limits := buildRateLimit $location }}
{{- range $limit := $limits }}