【发布时间】:2018-06-12 15:06:28
【问题描述】:
我有一个由 REST API 提供服务的静态 Web 客户端 SPA。我正在尝试找出在 Google 的云平台上托管这些应用程序的最佳方式,使用 App Engine 来托管 API,并使用 Cloud Storage 来托管静态 Web 客户端。
如果我从头开始这样做,一个简单的反向代理可以管理 API 和客户端资产之间的路由流量。为了对 GCP 做同样的事情,我查看了以下内容:
- Google 的 Compute Engine 支持 content-based load balancing:虽然 App Engine 没有等效项
- App Engine 上的 API 可以将请求代理到 Cloud Storage,但代价是 API 服务上的不必要负载
- 只需将 API 和客户端托管在不同的域(分别为 App Engine 和 Cloud Storage)上,并正确配置跨源问题
- 使用 Google Cloud Endpoints 作为反向代理在 App Engine 和 Cloud Storage 之间适当地路由流量:尚未完全探索此选项,但截至撰写本文时,Cloud Endpoints 确实使用了 not support routing to multiple hosts(仅在 v3 中定义) OpenAPI 规范)。
以上所有内容都有局限性。我正在尝试做的事情似乎相当传统,但我不确定 GCP 上阻力最小的路径是什么。
【问题讨论】:
-
类似问题about Cloud Endpoints + Cloud Functions。结论,不可能使用 Cloud Endpoints 跨多个服务进行路由。
-
你找到最好的方法了吗?
标签: google-app-engine google-cloud-platform google-cloud-storage google-cloud-endpoints