在GAE灵活环境中未添加X-Appengine-Inbound-Appid标头 [英] X-Appengine-Inbound-Appid header is not added in GAE flexible environment

查看:171
本文介绍了在GAE灵活环境中未添加X-Appengine-Inbound-Appid标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 https://cloud.google.com/appengine / docs / flexible / go / migrating#url_fetch ,在灵活的环境中,我们可以使用http lib而不是urlFetch,它应该添加与GAE相关的标题。

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.

我的应用程序处于灵活的环境中,但在发出http请求时未设置X-Appengine-Inbound-Appid。

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

我的应用程序在python中使用flask框架。

My app is in python using flask framework.

要测试是否设置了正确的标头,我正在向同一个应用程序(不同的端点)发出http请求。但是入站请求在标头中没有X-Appengine-Inbound-Appid。
这就是我打电话的方式:

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"

打印request.headers显示没有设置X-Appengine-Inbound-Appid。

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

任何人都知道如何解决这个问题?谢谢!

Anyone knows how to solve the issue? Thanks!

推荐答案

我做了一些研究并为GAE技术支持人员提供了帮助。

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


是的,这确实按预期工作,这个标题是由
提供的UrlFetch服务,在这种情况下没有使用,因此没有
组件附加此标题。

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.

以上是我从GAE支持中听到的内容。
所以...我相信flex env的X-Appengine-Inbound-Appid标题不可用。

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

这篇关于在GAE灵活环境中未添加X-Appengine-Inbound-Appid标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆