Force HTTPS: x-forwarded-host in finalize_test
Adds the logic to check and insert x-forwarded-host header during
https-redirect in finalize_test.go
@@ -595,14 +595,24 @@ var _ = Describe("Compile", func() {
}
`)
forceHTTPSConf := stripStartWsp(`
+ set $updated_host $host;
+ if ($http_x_forwarded_host != "") {
+ set $updated_host $http_x_forwarded_host;
+ }
+
if ($http_x_forwarded_proto != "https") {
- return 301 https://$host$request_uri;
+ return 301 https://$updated_host$request_uri;
}
`)
forceHTTPSErb := stripStartWsp(`
<% if ENV["FORCE_HTTPS"] %>
+ set $updated_host $host;
+ if ($http_x_forwarded_host != "") {
+ set $updated_host $http_x_forwarded_host;
+ }
+
if ($http_x_forwarded_proto != "https") {
- return 301 https://$host$request_uri;
+ return 301 https://$updated_host$request_uri;
}
<% end %>
`)
