-
-
Notifications
You must be signed in to change notification settings - Fork 432
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Effect is running?
No response
What steps can reproduce the bug?
Currently the xForwardedHeaders middleware only applies when there's an x-forwarded-host header. However, there are some cases where we expect to receive headers like x-forwarded-for without x-forwarded-host.
For example, this is the behaviour I'm seeing in an AWS Lambda. Related docs.
For this reason I would like to suggest changing the xForwardedHeaders middleware so it always uses x-forwarded-for if there is one.
effect/packages/platform/src/internal/httpMiddleware.ts
Lines 189 to 198 in f6c7ca7
| export const xForwardedHeaders = make((httpApp) => | |
| Effect.updateService(httpApp, ServerRequest.HttpServerRequest, (request) => | |
| request.headers["x-forwarded-host"] | |
| ? request.modify({ | |
| headers: Headers.set( | |
| request.headers, | |
| "host", | |
| request.headers["x-forwarded-host"] | |
| ), | |
| remoteAddress: request.headers["x-forwarded-for"]?.split(",")[0].trim() |
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working