Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing learnings from deploying on GCP Cloud Run #30

Open
robinjhuang opened this issue Dec 5, 2024 · 0 comments
Open

Sharing learnings from deploying on GCP Cloud Run #30

robinjhuang opened this issue Dec 5, 2024 · 0 comments

Comments

@robinjhuang
Copy link

I noticed that my geolocation was not being set. I tried trusting the IP ranges for my load balancers as well, but that did not work. I think an additional IP for my cloud run instance gets added as advised by this article, and that was hard to find documentation for a specific range.

Ended up just taking the first IP address (which in most cases should be the client's original IP) from the X-Forwarded-For header.

map $http_x_forwarded_for $first_x_forwarded_for {
        "~^(?P<first>[^,]+)" $first;
        default $http_x_forwarded_for;
    }

And send that as the Real-IP

proxy_set_header X-Real-IP $first_x_forwarded_for;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant