google-app-engine - 未设置 X-Appengine-Inbound-Appid header

标签 google-app-engine

我有两个 AppEngine 模块,一个运行 Python 的默认模块和一个运行 Java 的“java”模块。我正在使用 urlfetch 从默认模块访问 Java 模块。根据 AppEngine 文档 (cloud.google.com/appengine/docs/java/appidentity),我可以通过检查 X-Appengine-Inbound-Appid header 在 Java 模块中验证请求来自同一应用程序中的模块.

但是,未设置此 header (在生产部署中)。我在 Python 模块中使用 urlfetch,如下所示:

hostname = modules.get_hostname(module="java")
hostname = hostname.replace('.', '-dot-', 2)
url = "http://%s/%s" % (hostname, "_ah/api/...")
result = urlfetch.fetch(url=url, follow_redirects=False, method=urlfetch.GET)

请注意,我使用的是符号:

<version>-dot-<module>-dot-<app>.appspot.com

而不是符号:

<version>.<module>.<app>.appspot.com

由于某种原因导致 404 响应。

在 Java 模块中,我正在运行一个 servlet 过滤器,它按如下方式查看所有请求 header :

Enumeration<String> headerNames = httpRequest.getHeaderNames();
while (headerNames.hasMoreElements()) {
    String headerName = headerNames.nextElement();
    String headerValue = httpRequest.getHeader(headerName);
    mLog.info("Header: " + headerName + " = " + headerValue);
}   

AppEngine 确实设置了一些 header ,例如X-AppEngine-国家。但未设置 X-Appengine-Inbound-Appid header 。

为什么我没有看到记录的行为?任何建议将不胜感激。

最佳答案

看看我在 Google groups 上得到的回答,这导致了一个 issue opened on the public issue tracker .

正如我收到的答案中所建议的那样,您可以关注那里的问题以获取任何更新。

关于google-app-engine - 未设置 X-Appengine-Inbound-Appid header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26782249/

相关文章:

java - 当数据存在时,http 响应使用分块编码

mysql - Cloud SQL 的访问随机被拒绝

java - Selenium (XercesImpl) 和 Google App Engine 出现问题

python - 此处不允许映射值...在 foo.py 中

java - 在 App Engine 上使用 JDO 持久化 Protocol Buffer 模型

java - 新组件的 ReSTLet web.xml 配置

http - Go 中的 Google App Engine 自定义 IP 端口

google-app-engine - 应用引擎 : Unable to update app: Failed to compile jsp files

ssl - 使用 ZeroSSL 为谷歌应用引擎创建 SSL 证书并让我们加密

google-app-engine - 谷歌云端点主体阵列