Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular/ssr): ensure correct Location header for redirects behind a proxy #29162

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

alan-agius4
Copy link
Collaborator

Previously, when the application was served behind a proxy, server-side redirects generated an incorrect Location header, causing navigation issues. This fix updates createRequestUrl to use the port from the Host header, ensuring accurate in proxy environments. Additionally, the Location header now only contains the pathname, improving compliance with redirect handling in such setups.

Closes #29151

@alan-agius4 alan-agius4 requested a review from dgp1130 December 17, 2024 08:57
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Dec 17, 2024
packages/angular/ssr/node/src/request.ts Outdated Show resolved Hide resolved
packages/angular/ssr/node/src/request.ts Show resolved Hide resolved
packages/angular/ssr/src/app.ts Show resolved Hide resolved
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 17, 2024
…ind a proxy

Previously, when the application was served behind a proxy, server-side redirects generated an incorrect Location header, causing navigation issues. This fix updates `createRequestUrl` to use the port from the Host header, ensuring accurate in proxy environments. Additionally, the Location header now only contains the pathname, improving compliance with redirect handling in such setups.

Closes angular#29151
@dgp1130 dgp1130 merged commit ad1d7d7 into angular:main Dec 17, 2024
30 checks passed
@dgp1130
Copy link
Collaborator

dgp1130 commented Dec 17, 2024

The changes were merged into the following branches: main, 19.0.x

@alan-agius4 alan-agius4 deleted the proxy-redirect branch December 17, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @angular/ssr target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Angular server redirects to incorrect Location when serving the app behind a proxy
2 participants