App Engine 如何处理 HTTPS 请求?

How does App Engine handle HTTPS requests?

我正在将我的应用程序移动到 GCP App Engine,请求需要是 HTTPS。

我的服务器当前使用 HTTPS 模块处理 HTTPS 请求。在所有演示应用程序示例中,它们都仅提供 HTTP。

加密连接是否终止,然后作为 HTTP 请求传递给应用程序?如果是这样,这安全吗?

我知道您可以设置 app.yaml 以指定所有连接都是 'secure' 并使用 HTTPS 但这似乎不是很安全,因为如果该行丢失,那么流量现在不会加密,但会由于服务器配置为提供 HTTP 流量,仍可提供服务吗?

当您错过 secure 时,HTTP 和 HTTPS 均可提供。参见 this document

secure Optional. Any URL handler can use the secure setting, including script handlers and static file handlers. The secure element has the following possible values:

optional

Both HTTP and HTTPS requests with URLs that match the handler succeed without redirects. The application can examine the request to determine which protocol was used, and respond accordingly. This is the default when secure is not provided for a handler.

使用 GAE,负载均衡器和您的应用程序之间的连接始终是 HTTP。即使原始请求是 HTTPS,也是如此。负载平衡器设置 headers 让您知道请求最初是 HTTP 还是 HTTPS。

对于大多数人来说,这是可以接受的安全风险。 Google 防火墙后的请求肯定比 Google 防火墙外的请求安全得多。

如果这不是您可以接受的安全风险,那么您不能使用 GAE。

您可以要求最终用户和防火墙之间的连接始终为 HTTPS,例如通过自动将 HTTP 重定向到 HTTPS。