why is my ip getting blocked from Cloud Run instance

I have an image of nginx serving my react build content but on the nginx.conf only allow my own public ip and the line after deny all;

This should whitelist my ip and deny every other but when I hit my cloud run I get a 403 from nginx. What is the ip hitting the cloud run instance if not my own?

2 comments · 100% upvoted · other discussions

comments

BehindTheMath

It could be the load balancer IP, depending which variable you used. Log it and see.

martin_omander

The user's HTTP request goes to Google's servers, which then create a new HTTP request that goes to your Cloud Run service. The customer's IP address will be in the x-forwarded-for header.

Either inspect that header or set "trust proxy" in nginx, like I wrote in my other response. I don't know a lot about nginx, but maybe this is the right documentation?