Angular server redirects to incorrect Location when serving the app behind a proxy #29151
Closed
1 task
Labels
area: @angular/ssr
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When deploying Angular ssr server on services like Cloud Run or Firebase App Hosting where the application is served behind a frontend proxy, the Location header is incorrectly constructed, and redirect fails.
Minimal Reproduction
app.routes.ts
$ ng build && node dist/testme/server/server.mjs Node Express server listening on http://localhost:4000
This set up works fine in localhost:
But when connecting to a server behind a frontend proxy, the
Location
header is wrongNote the header
location: https://ng-redirect-bug--danielylee-90.us-central1.hosted.app:8080/blog
Specifically, the port is set to be
8080
which is the port used on the server, but the port used in the frontend proxy is actually at443
.Exception or Error
Your Environment
Anything else relevant?
The relevant code seems to be at
angular-cli/packages/angular/ssr/node/src/request.ts
Line 88 in e4ff5c9
The text was updated successfully, but these errors were encountered: