request-ip
request-ip copied to clipboard
Add support for K8S Ingress Header X-Original-Forwarded-For
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.
Is this library sill maintained?
Nice, but shouldn't it be before x-forwarded-for
?