Steven Barragán
Steven Barragán

Reputation: 1244

How to preserve client ip through a GCE ingress controller on kubernetes?

I've an gce ingress controller pointing to a service type NodePort.

Is there a way to preserve the client's ip? I've tried this from here, but it didn't work.

service.spec.externalTrafficPolicy = Local

I found some ways to do for nginx but none for an gce ingress.

Upvotes: 1

Views: 2261

Answers (1)

Steven Barragán
Steven Barragán

Reputation: 1244

The original ip comes in the X-Forwarded-For header. If you're using rails it may come as HTTP_X_FORWARDED_FOR

https://cloud.google.com/compute/docs/load-balancing/http/

Upvotes: 1

Related Questions