When running behind proxies it is often necessary for code to know what the URL the client used to connect to the server was (for the purposes of creating/checking cookies, creating fully qualified URLs, etc), but this requires parsing the request's X-Forwarded-* headers and recreating the URL based on this information (mainly host + protocol).
What is the feature you are proposing to solve the problem?
Doing this kind of rewriting is most conveniently done once at the app server level, hence Express's "trust proxy" feature. This is a pretty common situation.
What is the problem this feature would solve?
When running behind proxies it is often necessary for code to know what the URL the client used to connect to the server was (for the purposes of creating/checking cookies, creating fully qualified URLs, etc), but this requires parsing the request's X-Forwarded-* headers and recreating the URL based on this information (mainly host + protocol).
What is the feature you are proposing to solve the problem?
Doing this kind of rewriting is most conveniently done once at the app server level, hence Express's "trust proxy" feature. This is a pretty common situation.
What alternatives have you considered?
(1) Application code can handle this but it is error prone and redundant, see for example: https://github.com/honojs/middleware/issues/537
(2) Wrapping
fetch
could be done - for example https://jsr.io/@hongminhee/x-forwarded-fetch/0.2.0/mod.ts#L24 - but Bun doesn't like this, e.g., websockets cease to work: https://github.com/oven-sh/bun/issues/11382 - In any case it would be nice to have a utility to do so "baked in".