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: request url no forwarded host #256

Merged
merged 4 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/modern-baboons-build.md
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this changeset more concise?

i.e. “Fixed a regression where…”

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"frog": patch
---

Fixed a regression in local environments with templates other than `next` used where port was deleted when `X-Forwarded-Host` was not present that resulted in a malformed `postUrl` and `image` url values in the rendered frame meta tags.
3 changes: 2 additions & 1 deletion src/utils/getRequestUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function getRequestUrl(req: Context['req']) {
const forwardedHost = req.header('x-forwarded-host')
url.host = forwardedHost ?? url.host
url.protocol = req.header('x-forwarded-proto') ?? url.protocol
if (!forwardedHost?.startsWith('localhost')) url.port = ''
if (forwardedHost !== undefined && !forwardedHost.startsWith('localhost'))
url.port = ''
return url
}
Loading