Spring boot Disable response when https port is hit with http request

Viewed 5263

I have a spring boot application in which tomcat is listening on port 8000 over HTTPS. However, when port 8000 is hit with plain http request, the server responds with http 400.

Bad Request
This combination of host and port requires TLS.

Is there a way to prevent this? I don't want server to send any response when http://localhost:8000 is requested. Spring boot and tomcat versions are as below:

sprint-boot v2.0.0.RELEASE
tomcat v8.5.28

Update: application.properties is as below

server.port=8000
server.ssl.enabled=true
server.ssl.key-alias=alias
server.ssl.key-store=classpath:key.jks
server.ssl.key-store-type=JKS
server.ssl.key-store-password=<password>
server.ssl.key-password=<password>
1 Answers

You enabled SSL Just change server.ssl.enabled=true toserver.ssl.enabled=false

Related