request-ip icon indicating copy to clipboard operation
request-ip copied to clipboard

Add support for K8S Ingress Header X-Original-Forwarded-For

Open Ismaaa opened this issue 1 year ago • 2 comments

Hey there! I've added support for the X-Original-Forwarded-For header, which is used by Kubernetes Ingress.

I've also put together a few tests to make sure everything works as expected:

  • One test checks if we correctly pick the first IP when a list is passed.
  • Another test makes sure we handle an 'unknown' IP gracefully and pick the next valid one.
  • The last test ensures we correctly extract the IP when it comes with a port.

I believe these changes will make IP resolution in Kubernetes Ingress environments even better. Please have a look and let me know what you think.

Ismaaa avatar Jun 13 '23 18:06 Ismaaa

Is this library sill maintained?

patunalu avatar Sep 30 '23 16:09 patunalu

Nice, but shouldn't it be before x-forwarded-for?

spathon avatar Nov 22 '23 13:11 spathon