Skip to content

Commit f26c973

Browse files
author
Matthew Fisher
committed
fix(router): only add x-forwarded-proto on https
Prior to 1f74eeb, sending decrypted https traffic to port 80 worked fine in the case that there was an https endpoint/load balancer in front of the cluster. In this example, the addition of X-Forwarded-Proto changes the forwarded protocol from https to http. Making the prototype only available when an SSL certificate and key is installed fixes this.
1 parent 6cc93ad commit f26c973

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

router/templates/nginx.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ http {
9191
## end deis-store-gateway
9292

9393
## start service definitions for each application
94+
{{ $useSSL := or .deis_router_sslCert "false" }}
9495
{{ $domains := .deis_domains }}{{ range $service := .deis_services }}{{ if $service.Nodes }}
9596
upstream {{ Base $service.Key }} {
9697
{{ range $upstream := $service.Nodes }}server {{ $upstream.Value }};
@@ -104,7 +105,9 @@ http {
104105
location / {
105106
proxy_buffering off;
106107
proxy_set_header Host $host;
108+
{{ if ne $useSSL "false" }}
107109
proxy_set_header X-Forwarded-Proto $scheme;
110+
{{ end }}
108111
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
109112
proxy_redirect off;
110113
proxy_connect_timeout 10s;

0 commit comments

Comments
 (0)