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

Support Forwarded header (and perhaps others) for running behind a reverse proxy #213

Open
danfuzz opened this issue Jan 18, 2024 · 0 comments
Labels
enhancement New feature or request framework Has something to do with the system framework

Comments

@danfuzz
Copy link
Owner

danfuzz commented Jan 18, 2024

What is the crux of the problem you are trying to solve?

Lactoserv should be able to operated behind a reverse proxy, though it will need to be configurable whether it should operate that way.

Specifically, it needs to be able to recognize the Forwarded header when so configured, and use its info when constructing the corresponding Request object.

What is the shape of the solution?

  • Add a reverseProxy configuration to ProtocolWrangler, which has sufficient semantics to define how to treat Forwarded (etc.) headers.
  • Add a way to construct a Request with replacement values; this may or may not involve actual additional logic in the Request constructor. For example, it might make sense to define a wrapper around the underlying express.Request / IncomingMessage which "covers" things like .remoteAddress and get('host'), which would let Request blithely request the usual properties [waves hands].

Is there a workaround?

Not really. This needs to be handled at the framework level.

Additional context

The Forwarded header is the most modern way to convey this info, but there are a few X- headers that are de facto standard and perhaps should be (configurable to be) honored.

See these:

@danfuzz danfuzz added enhancement New feature or request framework Has something to do with the system framework labels Jan 18, 2024
@danfuzz danfuzz changed the title Support Forwarded (and perhaps others) for running behind a reverse proxy Support Forwarded header (and perhaps others) for running behind a reverse proxy Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request framework Has something to do with the system framework
Projects
None yet
Development

No branches or pull requests

1 participant