Firebase geo-headers lost when hit from hosted web-app domain

300 views
Skip to first unread message

Nithin G

unread,
May 30, 2019, 10:09:17 AM5/30/19
to Firebase Google Group
Hi,
I've a web-app hosted in firebase, alongwith a firebase-functions. Basically I hit the function from the hosted-web-app to fetch host's ip-related geo information that is available in the request-headers in firebase-functions ("x-appengine-city", "x-appengine-country" & "x-appengine-citylatlong"). It is working absolutely fine.

Yesterday, I tried serving firebase functions from the same domain as the hosted web-app (not my custom-domain, the default domain that firebase hosting provides) by adding a re-write in firebase.json. When I hit that rewritten url from firebase, I get invalid values for "x-appengine-city" details (I get "??"). Even the "x-appengine-citylatlong" are "0.0000,0.0000" now.

Eventually I plan to add a custom-domain to my host, and access my firebase function through that domain, but I cannot do that if get the above values.

Is there any way where I can add a rewrite for the firebase functions and still have access to the geo information?

Thanks,
Nithin

Michael Bleigh

unread,
May 30, 2019, 12:14:04 PM5/30/19
to Firebase Google Group
Because Firebase Hosting routes all of your requests through a CDN, the original geographic information ends up getting lost along the way to the Cloud Function so that data is not currently available. I'd encourage you to file a feature request / bug report at https://firebase.google.com/support so we can track it internally.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/41df1544-d36a-4ffa-8e3b-6b573f78117e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy Sistrunk

unread,
May 30, 2019, 3:39:17 PM5/30/19
to fireba...@googlegroups.com
Firestore’s internal GeoPoint query is not yet supported. I actually needed an implementation of something like this, so I chose the library geofirestore, this has the capability you are looking for. 

Nithin G

unread,
Jun 3, 2019, 10:44:50 AM6/3/19
to Firebase Google Group
I think the question is misunderstood (or maybe I did not understand your answer), but I am not using firestore (or any other data-store for that matter). Just the request headers from firebase functions.


On Friday, May 31, 2019 at 1:09:17 AM UTC+5:30, Jeremy Sistrunk wrote:
Firestore’s internal GeoPoint query is not yet supported. I actually needed an implementation of something like this, so I chose the library geofirestore, this has the capability you are looking for. 
On May 29, 2019, at 4:52 PM, Nithin G <nithin...@gmail.com> wrote:

Hi,
I've a web-app hosted in firebase, alongwith a firebase-functions. Basically I hit the function from the hosted-web-app to fetch host's ip-related geo information that is available in the request-headers in firebase-functions ("x-appengine-city", "x-appengine-country" & "x-appengine-citylatlong"). It is working absolutely fine.

Yesterday, I tried serving firebase functions from the same domain as the hosted web-app (not my custom-domain, the default domain that firebase hosting provides) by adding a re-write in firebase.json. When I hit that rewritten url from firebase, I get invalid values for "x-appengine-city" details (I get "??"). Even the "x-appengine-citylatlong" are "0.0000,0.0000" now.

Eventually I plan to add a custom-domain to my host, and access my firebase function through that domain, but I cannot do that if get the above values.

Is there any way where I can add a rewrite for the firebase functions and still have access to the geo information?

Thanks,
Nithin

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.

Nithin G

unread,
Jun 3, 2019, 10:44:51 AM6/3/19
to Firebase Google Group
Thanks. Have filed a bug-report. I guess this could be considered a bug.

On Thursday, May 30, 2019 at 9:44:04 PM UTC+5:30, Michael Bleigh wrote:
Because Firebase Hosting routes all of your requests through a CDN, the original geographic information ends up getting lost along the way to the Cloud Function so that data is not currently available. I'd encourage you to file a feature request / bug report at https://firebase.google.com/support so we can track it internally.

On Thu, May 30, 2019 at 7:09 AM Nithin G <nithin...@gmail.com> wrote:
Hi,
I've a web-app hosted in firebase, alongwith a firebase-functions. Basically I hit the function from the hosted-web-app to fetch host's ip-related geo information that is available in the request-headers in firebase-functions ("x-appengine-city", "x-appengine-country" & "x-appengine-citylatlong"). It is working absolutely fine.

Yesterday, I tried serving firebase functions from the same domain as the hosted web-app (not my custom-domain, the default domain that firebase hosting provides) by adding a re-write in firebase.json. When I hit that rewritten url from firebase, I get invalid values for "x-appengine-city" details (I get "??"). Even the "x-appengine-citylatlong" are "0.0000,0.0000" now.

Eventually I plan to add a custom-domain to my host, and access my firebase function through that domain, but I cannot do that if get the above values.

Is there any way where I can add a rewrite for the firebase functions and still have access to the geo information?

Thanks,
Nithin

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages