File tree 2 files changed +9
-5
lines changed
packages/astro/src/core/app
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 {
83
83
const hostname = forwardedHostname ?? req . headers . host ?? req . headers [ ':authority' ] ;
84
84
85
85
// @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' ] ) ;
89
87
90
88
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
+
93
92
const url = `${ protocol } ://${ hostnamePort } ${ req . url } ` ;
94
93
const options : RequestInit = {
95
94
method : req . method || 'GET' ,
You can’t perform that action at this time.
0 commit comments