google-cloud-platform - 使用云端点框架 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,而谷歌正在推广它。我是不是误会了什么?
谢谢!
解决方案
如果您使用的是 Endpoints Frameworks,那只是一个用于执行 API 策略(API 密钥、速率限制等)的代码库,这意味着 Endpoints 仅在建立 HTTPS 或 HTTP 连接后才涉及。
由于您在 App Engine 上运行 API,我建议您尝试将AppEngine 应用设置为 HTTPS-only。
推荐阅读
- vba - 根据列文本突出显示单元格值
- java - Jdbc 连接类方法 setAutoCommit() 行为
- javascript - 导入使用“import * as x”作为默认参数的函数
- oracle - 不同日期列的 case 语句
- swift - SceneKit 场景在 macOS 上高于预期的 FPS
- javascript - 模拟来自同一类的承诺返回方法
- ida - ida pro idc 脚本问题我无法解决任何想法?
- jenkins - 如何将 jenkins 管道中的 Jenkins 配置文件复制到 Web 服务器
- php - 使用 .htaccess 隐藏文件夹的文件扩展名
- java - 使用 Spring Boot 和 H2 运行测试时出现异常“无法加载 ApplicationContext”