File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ http {
127127
128128 ## start service definitions for each application
129129 {{ $useSSL := or .deis_router_sslCert "false" }}
130+ {{ $enforceHttps := or .deis_router_enforceHttps "false" }}
130131 {{ $domains := .deis_domains }}{{ range $service := .deis_services }}{{ if $service .Nodes }}
131132 upstream {{ Base $service .Key }} {
132133 {{ range $upstream := $service .Nodes }} server {{ $upstream .Value }} ;
@@ -157,6 +158,12 @@ http {
157158
158159 proxy_next_upstream error timeout http_502 http_503 http_504;
159160
161+ {{ if ne $enforceHttps "false" }}
162+ if ( $http_x_forwarded_proto != "https" ) {
163+ rewrite ^( .*) $ https://$host$1 permanent;
164+ }
165+ {{ end }}
166+
160167 add_header X-Deis-Upstream $upstream_addr ;
161168
162169 proxy_pass http ://{{ Base $service .Key }} ;
You can’t perform that action at this time.
0 commit comments