X-Appengine-Inbound-Appid header 未在 GAE 柔性环境中添加
X-Appengine-Inbound-Appid header is not added in GAE flexible environment
根据 https://cloud.google.com/appengine/docs/flexible/go/migrating#url_fetch ,在灵活的环境中我们可以使用 http lib 而不是 urlFetch 应该添加 GAE 相关 headers.
我的应用程序处于灵活环境中,但在发出 http 请求时未设置 "X-Appengine-Inbound-Appid"。
我的应用程序 python 使用 Flask 框架。
为了测试 headers 设置是否正确,我正在向同一个应用程序(不同端点)发出 http 请求。但是入站请求在 headers 中没有 "X-Appengine-Inbound-Appid"。
这就是我进行 http 调用的方式:
@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"。
有人知道如何解决这个问题吗?谢谢!
我做了一些研究并为 GAE 技术支持的帮助创建了一个案例。
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 支持那里听到的。
所以...我相信 "X-Appengine-Inbound-Appid" header for flex env 不可用。
根据 https://cloud.google.com/appengine/docs/flexible/go/migrating#url_fetch ,在灵活的环境中我们可以使用 http lib 而不是 urlFetch 应该添加 GAE 相关 headers.
我的应用程序处于灵活环境中,但在发出 http 请求时未设置 "X-Appengine-Inbound-Appid"。
我的应用程序 python 使用 Flask 框架。
为了测试 headers 设置是否正确,我正在向同一个应用程序(不同端点)发出 http 请求。但是入站请求在 headers 中没有 "X-Appengine-Inbound-Appid"。 这就是我进行 http 调用的方式:
@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"。
有人知道如何解决这个问题吗?谢谢!
我做了一些研究并为 GAE 技术支持的帮助创建了一个案例。
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 支持那里听到的。 所以...我相信 "X-Appengine-Inbound-Appid" header for flex env 不可用。