如何在Elastic Beanstalk上为Spring Boot后端服务器配置HTTPS,无需负载均衡器。

huangapple go评论77阅读模式
英文:

How to configure Springboot backend server on Elastic Beanstalk for HTTPS without load balancer

问题

我正在尝试为部署在 Elastic Beanstalk 上的 Spring Boot Web 服务器配置 HTTPS。由于这是用于测试环境,我计划使用自签名证书。我已经在 Postman 上本地测试过该应用程序,它可以正常工作。然而,在将应用程序部署到我的 Elastic Beanstalk(EBS)EC2 实例之后,我的 Postman 出现了以下错误:

> 错误:连接被拒绝(ECONNREFUSED)

以下是我所采取的所有步骤,是否有遗漏的内容?

  1. 创建自己的 SSL 证书并更新我的 Spring 应用程序属性 - 这里不应该有任何问题,因为它在本地主机上可以工作
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:keystore/keystorename.p12
server.ssl.key-store-password=password
server.ssl.key-alias=alias
server.ssl.enabled=true
  1. 允许我的 Elastic Beanstalk 实例的安全组接受 HTTPS - 打开入站的 443 端口
  2. HTTP 可以正常工作,只有在为 Spring Boot 启用 SSL 时才会收到此连接被拒绝的错误

注意:我的 Spring Boot 后端是使用 Maven 安装的 JAR 应用程序部署在我的 Elastic Beanstalk 上。

英文:

I am trying too configure my Springboot web server deployed on EBS for https. As this is for a test environment I am planning to use a self-signed certificate. I have tested the application locally on postman and it works. However, after deploying the application to my EBS, ec2 instance my postman is giving:

> Error: connect ECONNREFUSED

Below are all the steps that I have taken, did I miss out on anything?

  1. Creating my own SSL cert and updating my spring application properties - there should not be any issues here as it works on localhost
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:keystore/keystorename.p12
server.ssl.key-store-password=password
server.ssl.key-alias=alias
server.ssl.enabled=true
  1. Allowing my security group for my EBS instance to accept HTTPS - opening port 443 for inbound
  2. Http works perfectly fine, this error connection refused is only received when i enable ssl for my springboot

Note: My springboot backend is deployed using a maven installed jar application on my EBS.

答案1

得分: 0

"connect ECONNREFUSED"错误意味着应用未在443端口上运行,或者防火墙阻止了连接。您可以执行telnet [ip] 443来确认。如果问题是SSL,telnet仍然会连接,但您将收到与SSL证书相关的错误。

英文:

The error "connect ECONNREFUSED" means that application is not running on port 443 or a firewall blocked you. you can do telnet [ip] 443 to confirm that. If the problem is SSL, the telnet will still connect, but you will receive an error related to ssl cert

huangapple
  • 本文由 发表于 2020年8月22日 19:13:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/63535495.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定