我有两个AppEngine模块,一个是运行Python的默认模块,另一个是运行Java的"java“模块。我使用urlfetch从默认模块访问Java模块。根据Java (cloud.google.com/appengine/docs/java/appidentity),,我可以在AppEngine模块中通过检查X-Appengine-Inbound-Appid头来验证请求是否来自同一应用程序中的模块。
但是,此标头未设置(在生产部署中)。我在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过滤器,它按如下方式查看所有请求头:
Enumeration<String> headerNames = httpRequest.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = httpRequest.getHeader(headerName);
mLog.info("Header: " + headerName + " = " + headerValue);
} AppEngine确实设置了一些头部,例如X-AppEngine-Country。但未设置X-Appengine-Inbound-Appid头部。
为什么我看不到记录在案的行为?任何建议都将不胜感激。
发布于 2015-06-18 17:15:34
看看我在Google groups上得到了什么答案,这导致了一个issue opened on the public issue tracker。
正如我收到的答案中所建议的那样,你可以关注那里的任何更新。
https://stackoverflow.com/questions/26782249
复制相似问题