首页 > 解决方案 > 使用云端点框架 v2 实施 Https

问题描述

我目前在 Appengine 应用程序上使用云端点框架。

是否可以对暴露的端点强制执行 Https 协议?
现在,我可以在 https 和 http 中调用我的端点。
我想知道我们是否可以像在 appengine 中将“传输保证”设置为机密一样设置重定向到 Https。

例如,当我在 Http 上调用驱动 API 时,我收到以下消息

{
"error": {
    "errors": [
        {
            "domain": "global",
            "reason": "sslRequired",
            "message": "SSL is required to perform this operation."
        }
    ],
    "code": 403,
    "message": "SSL is required to perform this operation."
}

}

我希望云端点框架具有相同的行为。

附属问题我发现没有办法在云端点框架上设置 HTST,而谷歌正在推广它。我是不是误会了什么?

谢谢!

标签: google-cloud-platformgoogle-cloud-endpointsgoogle-cloud-endpoints-v2

解决方案


如果您使用的是 Endpoints Frameworks,那只是一个用于执行 API 策略(API 密钥、速率限制等)的代码库,这意味着 Endpoints 仅在建立 HTTPS 或 HTTP 连接后才涉及。

由于您在 App Engine 上运行 API,我建议您尝试将AppEngine 应用设置为 HTTPS-only


推荐阅读