Skip to content

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

Description

@danfuzz

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestframeworkHas something to do with the system framework

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions