I have a Spring Boot 1.5.21 application which runs on HTTPS. I want to redirect HTTP requests into HTTPS for same port. My application.yaml
is as follows:
server:
port: 8443
error:
whitelabel:
enabled: false
ssl:
key-store: classpath:keystore/tomcat.p12
key-store-type: PKCS12
key-store-password: password
key-alias: tomcat
When I enter this into URL bar:
http://localhost:8443
I see that error as usual:
Bad Request
This combination of host and port requires TLS.
When I refresh the page, doesn't happen. When I click the URL bar and click enter again at Chrome, link is redirected.
My questions:
- How can I make that URL:
http://localhost:8443
automatically redirect to:
https://localhost:8443
- If below is not applicable, how can I remove that message?
There is a similar question here which asks for different ports and answer does not work for my case: Spring Boot redirect HTTP to HTTPS