Support standard `Forwarded` header in Node adapter output
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the problem
I've recently learned about the existence of the Forwarded header, which is a standard I'd never heard of before, but it apparently replaces the several other X-Forwaded-* headers that have been de facto standards for a while. The Node adapter does not support pulling its protocol, host, and client IP address information from this header.
Describe the proposed solution
This should be something that the user should be able to opt in to via runtime environment variables passed to the built Node application. Determining the API here is probably going to be half the battle.
We should probably have this work in the same "count from the right" way that the X-Forwarded-For header does. At that point, we can take the for, host, and proto values from that segment of the header. I don't know what we should do if the header appears to be malformed. Is that an instant 500 before the request even reaches the rest of the app?
I don't know whether we want to allow Forwarded to be used simultaneously with the other PROTOCOL_HEADER, HOST_HEADER, ADDRESS_HEADER env vars. Probably not?
I don't know how we want parsing the Forwarded header to be enabled. A single FORWARDED_DEPTH env var maybe? Since it's a standard, I don't know how valuable it is to allow people to use a different header name.
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Node adapter's existing handling of X-Forwarded-For and the PROTOCOL_HEADER, HOST_HEADER, and ADDRESS_HEADER environment variables. Research the Forwarded header format and resolve the open API, precedence, depth, and malformed-header questions. Done means the supported configuration and behavior are defined and covered by the adapter's tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100