I’ve a simple setup with a Cilium Gateway on DOKS, with a few HTTPRoutes setup pointing to some pods running NodeJS apps. Everything is working perfectly except I’m unable to retrieve the original request IP, which I need for request logging.
According to the documentation I should be able to retrieve the original IP from the x-forwarded-for header. This header only contains a single private IP, other headers don’t contain the IP address either.
Did anyone succeed to retrieve the original IP from a request? How did you do it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
I might be wrong, but this usually comes down to how traffic enters a DOKS cluster, not a Cilium or Gateway API issue.
By default, DigitalOcean load balancers do not preserve the client source IP. What reaches your Gateway is the node or proxy IP, which is why x-forwarded-for only contains a private address.
In practice, you have two options:
Rely on X-Forwarded-For, but only if the load balancer is terminating HTTP(S) and adding it correctly.
Enable PROXY protocol on the DigitalOcean load balancer and make sure your Cilium Gateway supports and parses it.
If PROXY protocol isn’t enabled or supported in your setup, you won’t be able to see the real client IP. I’d double-check the load balancer configuration and Cilium version, and if it’s still not working, opening a support ticket is probably the best way to confirm what’s supported today:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.