0

The last version of AppEngine removed some usefull headers like X-APPENGINE-COUNTRY, X-APPENGINE-REGION, X-APPENGINE-CITY and X-APPENGINE-CITYLATLONG.

I liked this headers because it was an easy/free way to approximately geolocalize users. Is there an alternative or other headers to keep this simplicity ?

Thank you.

Loïc B.
  • 83
  • 3
  • 9
  • Only removed for GAE Flexible. – gaefan Jan 03 '17 at 16:50
  • Based on this [discussion](http://stackoverflow.com/a/40985895/1626477) all new projects are constraint to "Flex mode" and "VM mode" should expire in 6 month, my question stay valid : "Is there an alternative or other headers to keep this simplicity ?" – Loïc B. Jan 23 '17 at 21:23
  • Your question is certainly valid, but I mean to say these headers are still available for the standard environment. The many permutations of Google cloud services gets confusing but this [link](https://cloud.google.com/appengine/docs/the-appengine-environments) should help. People can certainly start new standard projects and standard projects are not going away. – gaefan Jan 23 '17 at 23:49
  • Hi @JeffO'Neill, I'm using Node.js and since the last update I can only use Flex as Google App Engine environment. When a try to deploy a new project with "vm:true" I got this : ``ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Deployments to App Engine Flexible require `env: flex` in app.yaml. The `vm:true` setting has been deprecated. To learn more, please visit https://cloud.google.com/appengine/docs/flexible/python/upgr‌​ading.`` So in my case "standard projects" are going away right now :( ... – Loïc B. Jan 24 '17 at 22:29

4 Answers4

1

The documentation has been updated and these headers are not planned to be removed anymore:

Removed headers

Headers that match the following pattern are removed from the request:

X-Google-* In addition, some selected headers that match the following pattern are removed from the request:

X-Appengine-* Added headers

App Engine adds the following headers to all requests:

Via: "1.1 google"

  • X-AppEngine-Country [...]
  • X-AppEngine-Region [...]
  • X-AppEngine-City [...]
  • X-AppEngine-CityLatLong [...]
  • X-Cloud-Trace-Context [...]
  • X-Forwarded-For: [...]
  • X-Forwarded-Proto [...]
Loïc B.
  • 83
  • 3
  • 9
  • 1
    If you're using `Node.js` take note that all keys in `req.headers` are lowercase. Therefore you have to access the fields via e.g. `req.headers['x-appengine-country']`. See also [this question](https://stackoverflow.com/a/51267296/646062). – philsch Jan 24 '19 at 11:03
0

As far as I know the headers are still there according to the Nov 16 update.

https://cloud.google.com/appengine/docs/go/how-requests-are-handled

Some standards were deprecated in order to apply the ISO standard.

Nilo_DS
  • 783
  • 6
  • 14
0

Currently, the X-AppEngine-(Country|City|CityLatLong|Region) headers are not available in the flexible environment.

To clarify Nilo_DS's response, the headers are still available in the Standard environment, https://cloud.google.com/appengine/docs/python/how-requests-are-handled#app-engine-specific-headers.

  • Hi, thank you for your answer. I understand it's still available in the "Standard environment", but is it possible to deploy new project as "Standard environment" ? I tried to keep my app.yaml with "vm: true" instead of the new "env: flex" parameter and I get this : ``ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Deployments to App Engine Flexible require `env: flex` in app.yaml. The `vm:true` setting has been deprecated. To learn more, please visit https://cloud.google.com/appengine/docs/flexible/python/upgrading.`` – Loïc B. Jan 23 '17 at 14:28
0

https://cloud.google.com/appengine/docs/flexible/python/reference/request-headers

The docs suggest the headers can be used in flex.

I have tested a nodejs flex service and got information back for:

"x-appengine-country": "GB",
"x-appengine-region": "eng",
"x-appengine-city": "blank for security",
"x-appengine-citylatlong": "blank for security"
solo1977
  • 157
  • 1
  • 12