-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(node): add PORT_HEADER
env var for reverse proxies with non-standard ports
#11249
feat(node): add PORT_HEADER
env var for reverse proxies with non-standard ports
#11249
Conversation
… ports Add support for the `PORT_HEADER` environment variable, that can be used to read the original port of a request from a reverse proxy, which is needed if the reverse proxy is hosted on a non-standard port (e.g. not port 80 for http nor port 443 for https). This port is normally added as part of a [`x-forwarded-port`][1], which is used by many reverse proxies, although it's not as popular as the more common [`x-forwarded-proto`][2] and [`x-forwarded-host`][3] headers. [1]: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html#x-forwarded-port [2]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto [3]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host
🦋 Changeset detectedLatest commit: 3a64fab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a reasonable addition. For the documentation, though, is there a more agnostic source we can link to about the X-Forwarded-Port
header? If not, I'd probably rather just not link to anything than link to an AWS documentation page.
…tandard ports Remove link to AWS docs.
I've removed this link. Unfortunately, the only agnostic source I could find was https://dzone.com/articles/what-are-x-forwarded-headers-and-why-is-it-used, but it looks like that article might have been plagiarized from https://requestly.io/blog/what-are-x-forwarded-headers-and-why-it-is-used/, which is another product specific link. Searching for "X-Forwarded-Port" on GitHub gives 44k matches, so it's clearly popular, but not popular enough to be on MDN! I did find this blog post briefly mentioning it, but only in relation to the RFC 7239 |
thank you! |
Add support for the
PORT_HEADER
environment variable to@sveltejs/adapter-node
that can be used to read the original port of a request from a reverse proxy, which is needed if the reverse proxy is hosted on a non-standard port (e.g. not port 80 for http nor port 443 for https).This port is normally added as part of a
x-forwarded-port
header, which is used by many reverse proxies, although it's not as popular as the more commonx-forwarded-proto
andx-forwarded-host
headers.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
adapter-node
have been broken and disabled since ecb423b, seekit/packages/adapter-node/package.json
Line 29 in 336d8ae
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
pnpm test
is failing for me on themaster
branch, but I don't think this is necessary, sinceadapter-node
doesn't currently have any tests. I have linted and checked my changes.Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.