1

According to https://cloud.google.com/appengine/docs/flexible/go/migrating#url_fetch ,in flexible environment we can use http lib instead of urlFetch which is supposed to add GAE related headers.

My app is in flexible environment but "X-Appengine-Inbound-Appid" is not set when it makes http request.

My app is in python using flask framework.

To test is the right headers got set, I'm making http request to the same app (different endpoint). But the inbound request doesn't have "X-Appengine-Inbound-Appid" in the headers. This is how I made http call:

@app.route('/ping')
def ping():
    res = requests.get("https://myapp.appspot.com/pong")
    print res.status_code
    return "ping"

@app.route('/pong')
def pong():
    print request.headers
    return "pong"

print request.headers shows that no "X-Appengine-Inbound-Appid" was set.

Anyone knows how to solve the issue? Thanks!

Jaycee Jiang
  • 153
  • 1
  • 8
  • In the standard env the sending app must set this header. It's set automatically only if sending with urlfetch, with `follow_redirects` set to `False` and when accessing the other app through its `appspot.com` domain name. The header is also mentioned in the context of the App Identity API, which is not available in the flex env. – Dan Cornilescu Apr 04 '17 at 04:59
  • @DanCornilescu Do you know how to set "X-Appengine-Inbound-Appid" when sending request in flex env? I think flex env should automatically wrap http request for me, but it seems not. – Jaycee Jiang Apr 04 '17 at 05:37
  • Manually setting request headers is not flex-specific. Check flask docs on setting request headers. I didn't use flask, so I don't know. – Dan Cornilescu Apr 04 '17 at 12:28

1 Answers1

3

I did some research and created a case for GAE tech support's help.

Yes, this is indeed working as intended, this header is provided by the UrlFetch service, which isn't used on this case so there isn't a component to append this header.

Above is what I heard from GAE support. So... I believe "X-Appengine-Inbound-Appid" header for flex env is not available.

Jaycee Jiang
  • 153
  • 1
  • 8