File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
packages/astro/src/core/app Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' astro ' : patch
3+ ---
4+
5+ Fix a regression where a port was incorrectly added to the ` Astro.url `
Original file line number Diff line number Diff line change @@ -83,13 +83,12 @@ export class NodeApp extends App {
8383 const hostname = forwardedHostname ?? req . headers . host ?? req . headers [ ':authority' ] ;
8484
8585 // @example "443,8080,80" => "443"
86- const forwardedPort = getFirstForwardedValue ( req . headers [ 'x-forwarded-port' ] ) ;
87- const port =
88- forwardedPort ?? req . socket ?. remotePort ?. toString ( ) ?? ( isEncrypted ? '443' : '80' ) ;
86+ const port = getFirstForwardedValue ( req . headers [ 'x-forwarded-port' ] ) ;
8987
9088 const portInHostname = typeof hostname === 'string' && / : \d + $ / . test ( hostname ) ;
91- const hostnamePort = portInHostname ? hostname : `${ hostname } :${ port } ` ;
92-
89+ const hostnamePort = portInHostname ? hostname : `${ hostname } ${ port ? `:${ port } ` : '' } ` ;
90+
91+
9392 const url = `${ protocol } ://${ hostnamePort } ${ req . url } ` ;
9493 const options : RequestInit = {
9594 method : req . method || 'GET' ,
You can’t perform that action at this time.
0 commit comments