【问题标题】:X-Appengine-Inbound-Appid header not setX-Appengine-Inbound-Appid 标头未设置
【发布时间】:2023-03-22 15:54:01
【问题描述】:

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

但是,未设置此标头(在生产部署中)。我在 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-国家。但是 X-Appengine-Inbound-Appid 标头没有设置。

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

【问题讨论】:

    标签: google-app-engine


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-06
      • 1970-01-01
      • 2021-05-06
      • 2017-06-01
      • 2023-03-08
      • 2020-05-15
      相关资源
      最近更新 更多