You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The x-forwarded-for is the standard way to extract IP addresses from a proxy so it was implemented that way. This also works with the new ALB routing (which doesn't have an IP address as part of the request context).
However, I can see the issue with your local use case, so I can add a fallback if the x-forwarded-for is undefined or null.
Thanks for the report,
Jeremy
jeremydaly
changed the title
QUESTION about how/why IP is mapped
Add requestContext.sourceIp fallback for missing x-forwarded-for
Dec 12, 2018
The
REQUEST.ip
property is mapped from thex-forwarded-for
header instead of thesourceIp
property on theevent.requestContext
property.Can you give me the info about why?
The problem I have is when running this in serverless-local to emulate a lambda locally for my testing, the ip comes through as undefined.
The text was updated successfully, but these errors were encountered: