Skip to content

request.ip property shadows/overrides the Express request.ip property (BUG) #348

Description

@poebrand

this.ip = remoteAddress;

ServerlessRequest defines an ip property when it extends IncomingMessage. This property definition shadows the ip property defined by Express as noted at https://expressjs.com/en/api.html#req.ip.

By doing this, the Express trust proxy settings have no effect and the ip property does not reflect the IP address of the client that originally made the call.

Looking at the H4ad code base, it doesn't appear to use this ip property directly. If that's correct, can we change this implementation so it doesn't shadow the property defined by Express and maybe other libraries?

A few alternative ideas are:

  1. Don't define the ip property at all.
  2. Define the ip property if it doesn't exist already.
  3. Define a remoteAddress property instead of an ip property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions