首页 > 解决方案 > gcp负载均衡器和springboot应用程序之间的ssl连接

问题描述

目前,我的 Web 应用程序compute engine通过spring boot应用程序运行。我的网站ssl受到保护,它连接到我的gcp load balancer. 但是,theload balancer和 my之间的联系spring boot applicationhttp. 我怎样才能做到这https一点?我需要提供哪些细节。我的应用程序部署在 gcp 计算虚拟机上。

标签: spring-bootgoogle-cloud-platform

解决方案


以下是我遵循的步骤:-

  • 假设您处于开发和测试阶段,则生成自签名证书(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。


推荐阅读