Skip to content

fix: Use correct port for alternate links when running behind a proxy… - #514

Merged
amannn merged 4 commits into
amannn:mainfrom
iza-w:fix/port-alternate-links
Sep 21, 2023
Merged

fix: Use correct port for alternate links when running behind a proxy…#514
amannn merged 4 commits into
amannn:mainfrom
iza-w:fix/port-alternate-links

Conversation

@iza-w

@iza-w iza-w commented Sep 20, 2023

Copy link
Copy Markdown
Contributor

When the application runs behind a proxy, the x-forwarded-host header contains the correct host and port information. However, the port in the request.url may not match the actual port used by the proxy. By overriding the port with an empty string, we ensure that alternate links are generated correctly, reflecting the proxy's host and eliminating potential inconsistencies.

@vercel

vercel Bot commented Sep 20, 2023

Copy link
Copy Markdown

@iza-w is attempting to deploy a commit to the next-intl Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Sep 20, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 21, 2023 1:24pm
next-intl-example-next-13 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 21, 2023 1:24pm

@amannn amannn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, thank you so much for this PR @iza-w!

I took the liberty to add another test and tweak the handling slightly.

Will merge this as soon as CI is green.

@amannn
amannn merged commit 747ad5b into amannn:main Sep 21, 2023
juanforlizzi pushed a commit to juanforlizzi/next-intl that referenced this pull request Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants