Add port to to the header in Nginx config (#5101)

* Add port to to the header in Nginx config

Using `$host` only for the header in Nginx config causes that Kestrel knows only that its host name is *hostname.com* without any port. That will cause problems in redirecting (e.g. to login page). I added the `$server_port` as well. So the hostname will become *hostname.com:8080* for example. That solves any related redirecting problems.

* Using $http_host in nginx config

`$http_host` is more accurate that `$host` because if includes the port number. using `$host` will cause problems when running kestrel behind reverse proxy on ports other than the standard ports (80 and 443).
pull/5110/head
Mohammed Noureldin 2018-01-04 20:18:00 +01:00 committed by Scott Addie
parent eb9e5af270
commit 36868fb63c
1 changed files with 1 additions and 1 deletions

View File

@ -116,7 +116,7 @@ server {
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive; proxy_set_header Connection keep-alive;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade; proxy_cache_bypass $http_upgrade;
} }
} }