spring-boot - gcp负载均衡器和springboot应用程序之间的ssl连接
问题描述
目前,我的 Web 应用程序compute engine
通过spring boot
应用程序运行。我的网站ssl
受到保护,它连接到我的gcp load balancer
. 但是,theload balancer
和 my之间的联系spring boot application
是http
. 我怎样才能做到这https
一点?我需要提供哪些细节。我的应用程序部署在 gcp 计算虚拟机上。
解决方案
以下是我遵循的步骤:-
- 假设您处于开发和测试阶段,则生成自签名证书(PKCS12 格式),否则在 PROD 中您将需要 CA 签名或类似证书
- 使用您的 P12 证书生成密钥并将其存储到密钥库
通过设置以下属性使您的启动应用程序启用
server.ssl.enabled=true
# The path to the keystore containing the certificate
server.ssl.key-store=classpath:keystore/yourCertificate.p12
# The password used to generate the certificate
server.ssl.key-store-password=password
# The alias mapped to the certificate
server.ssl.key-alias=yourAlias
# The format used for the keystore.
server.ssl.key-store-type=PKCS12
这些步骤将帮助您启用启动应用程序 HTTPS。
推荐阅读
- c# - 从字符串动态构建 LINQ 查询
- sql - 将日期范围分组为 15 天的滚动组
- android - 为什么我找不到在发布构建类型 APK 上运行仪器测试的简单方法?
- php - 在 WooCommerce 中获取简单和可变产品的最低价格
- c# - 如何在 C# 中使用 Azure API 管理中的 SOAP Pass-through 服务
- javascript - 如何对折线点进行网格化?Pathfinding.js 库
- scala - Scala 中 Java 反射的类型安全使用
- html - 我的 CSS 阻止下拉导航栏的引导代码工作
- javascript - 在 Chrome 中为音频启用自动播放策略标志
- javascript - 在 Promise 中获取/捕获响应状态