File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,13 @@ const createServer = () => {
4040 /* istanbul ignore next: cannot be tested on Travis */ httpPort = 80 ,
4141 httpsPort = process . env . PORT || 443 ) {
4242 app . http = http . createServer ( ( req , res ) => {
43+ const reqHost = req . headers [ "host" ]
44+ ? req . headers [ "host" ] . replace ( ":" + httpPort , "" )
45+ : /* istanbul ignore next: cannot be tested */ "localhost"
4346 res . writeHead ( 301 , {
44- Location : "https://" + req . headers [ "host" ] . replace ( ":" + httpPort , "" ) +
45- ( httpsPort !== 443 ? ":" + httpsPort : "" ) + req . url
47+ Location : "https://" + reqHost +
48+ ( httpsPort !== 443 ? ":" + httpsPort : "" ) + ( req . url ||
49+ /* istanbul ignore next: cannot be tested */ "" )
4650 } )
4751 res . end ( )
4852 } ) . listen ( httpPort )
You can’t perform that action at this time.
0 commit comments