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

问题描述

限时删除!!

根据,在灵活的环境中,我们可以使用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.

以上是我从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标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 23:57