Let's Encrypt:SSL 证书对域有效,但特定端口无效(net::ERR_SSL_PROTOCOL_ERROR)

Let's Encrypt:SSL 证书对域有效,但特定端口无效(net::ERR_SSL_PROTOCOL_ERROR)

我正在使用 VPS:Amazon EC2 和 SSL 证书提供商:Let's Encrypt(通过 Certbot)

我看到了某种问题,但答案对我的情况没有用。我有一个api.example.com在 Ubuntu 服务器上配置并完全正常运行的域。我使用 Certbot 使用 HTTPS 配置域,但是,我还配置了可在该域的特定端口(例如 8443)上访问的 API。

当我访问 api.example.com 时,我看到浏览器上有锁,表示该网站是安全的,但每当我尝试访问我的 api 时api.example.com:8443/v1/someAPI,API 都会返回相应的结果,但没有网站是安全的。由于主站点是安全的,而 API 访问位置不安全,因此我无法相应地进行 API 调用,导致net::ERR_SSL_PROTOCOL_ERROR

我的application.properties

# Database
db.driver: com.mysql.cj.jdbc.Driver
db.url: jdbc:mysql://123.123.123.123:123/ex?serverTimeZone=UTC&useSSL=false
db.username: xx
#db.password: xxx
db.password: xxxxxx
 
# Hibernate
hibernate.dialect: org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql: false
hibernate.hbm2ddl.auto: validate
hibernate.format_sql = false
entitymanager.packagesToScan: com.example

# GZIP Server compression
server.compression.enabled: true
server.compression.min-response-size: 2048
server.compression.mime-types: application/json,application/xml,text/html,text/xml,text/plain

# File Path
file.path: /home/ec2-user/
file.report.path: /home/ec2-user/
jpa.repositories.enabled=false

multipart.enabled=true
multipart.max-file-size=50MB
multipart.max-request-size=50MB

spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=50MB

# server base path
base.path: https://api.example.com:8443

# Origins to allow requests from
origins: *

#Error Page Configuration
server.error.whitelabel.enabled=false
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration

reportUrl:https://example.com/report/
[email protected]
emails=sales@[email protected]

# SMTP Configuration
spring.mail.enabled=true
spring.mail.from=sales@[email protected]
##Amazon SES SMTP config
spring.mail.host=email-smtp 
spring.mail.username=fsdfskfjsldfjf
spring.mail.password=ffdfsfdsfdsfsdfdsf
spring.mail.port=123

eds.users: [email protected]
eds.host: smtp.gmail.com
eds.port: 123
eds.fromname==example

##SSL details
server.port:8443
security.require-ssl=true

server.ssl.key-store:classpath:abc.p12
server.ssl.key-store-password:abc
server.ssl.keyStoreType:PKCS12
server.ssl.keyAlias:abc

8443我还为端口 [![在此处输入图像描述][1]][1]添加了一条规则

我在服务器日志中收到错误:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.1)

2021-08-28 15:47:04.463  INFO 4513 --- [           main] c.a.MarketResearcher.ApplicationWar      : Starting ApplicationWar v0.0.1-SNAPSHOT using Java 1.8.0_302 on ip-172-31-17-203.ap-south-1.compute.internal with PID 4513 (/home/ec2-user/MarketResearcher-0.0.1-SNAPSHOT.jar started by root in /home/ec2-user)
2021-08-28 15:47:04.467  INFO 4513 --- [           main] c.a.MarketResearcher.ApplicationWar      : The following profiles are active: prod
2021-08-28 15:47:06.924  INFO 4513 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$b39d77f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-08-28 15:47:07.008  INFO 4513 --- [           main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2021-08-28 15:47:07.705  INFO 4513 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8443 (https)
2021-08-28 15:47:07.729  INFO 4513 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-08-28 15:47:07.730  INFO 4513 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-08-28 15:47:07.852  INFO 4513 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-08-28 15:47:07.852  INFO 4513 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3164 ms
2021-08-28 15:47:08.432  INFO 4513 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.25.Final
2021-08-28 15:47:08.894  INFO 4513 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-08-28 15:47:09.462  INFO 4513 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2021-08-28 15:47:09.613  INFO 4513 --- [           main] o.h.e.boot.internal.EnversServiceImpl    : Envers integration enabled? : true
2021-08-28 15:47:12.758  INFO 4513 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-08-28 15:47:13.322  INFO 4513 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-08-28 15:47:15.192  INFO 4513 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8443 (https) with context path ''
2021-08-28 15:47:15.223  INFO 4513 --- [           main] c.a.MarketResearcher.ApplicationWar      : Started ApplicationWar in 11.771 seconds (JVM running for 12.677)
2021-08-28 15:52:41.387  INFO 4513 --- [nio-8443-exec-6] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-08-28 15:52:41.388  INFO 4513 --- [nio-8443-exec-6] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-08-28 15:52:41.390  INFO 4513 --- [nio-8443-exec-6] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms
2021-08-28 16:06:33.275  WARN 4513 --- [nio-8443-exec-4] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.391  WARN 4513 --- [nio-8443-exec-4] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.683  WARN 4513 --- [nio-8443-exec-4] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.738  WARN 4513 --- [nio-8443-exec-1] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.739  WARN 4513 --- [nio-8443-exec-3] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.747  WARN 4513 --- [io-8443-exec-10] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.845  WARN 4513 --- [nio-8443-exec-5] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:33.866  WARN 4513 --- [nio-8443-exec-2] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-28 16:06:34.021  WARN 4513 --- [nio-8443-exec-7] org.hibernate.orm.deprecation            : HHH90000022: Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA javax.persistence.criteria.CriteriaQuery instead
2021-08-29 19:08:38.141  INFO 4513 --- [nio-8443-exec-5] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol [RTSP/1.00x0d0x0a0x0d...]
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:559) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) [tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) [tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_302]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_302]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.41.jar!/:9.0.41]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_302]

相关内容