Is there a way to get geolocation when the user is behind a proxy?

174 views
Skip to first unread message

Alex G

unread,
Sep 28, 2017, 10:10:32 AM9/28/17
to Google App Engine
I'm using Varnish (Fastly) between the user and App Engine (flexible). When I read the X-AppEngine-Country header it seems it is getting the IP from the proxy.
This happens even when I set app.enable('trust proxy') in Express.

Is there a way to overcome this?

Yannick (Cloud Platform Support)

unread,
Sep 28, 2017, 3:42:47 PM9/28/17
to Google App Engine
Hello Alex,

Proxies will usually use the X-Forwarded-For header to denote which IP the request originated from. You may do your own geolocation based on that value.

As for getting X-AppEngine-Country to use the value of X-Forwarded-For, there is an open request for that feature on the Issue Tracker.

Alex G

unread,
Sep 29, 2017, 3:44:59 AM9/29/17
to Google App Engine
Thanks, Yannick. I hope App Engine implements this since I'm interested in the geolocation that Google provides.
However, by looking at the creation date of the request (more than 5 years ago), it is probably not going to happen.

Yannick (Cloud Platform Support)

unread,
Sep 29, 2017, 9:16:31 AM9/29/17
to Google App Engine
Older feature requests have been implemented before. Requests that get more attention on the issue tracker are often prioritized.
Reply all
Reply to author
Forward
0 new messages