I'm newbie with Spring Boot.
I'm trying to make a https call to a service, I have a Privake key to secure connection.
I hit:
http://localhost:8081/points/12345/search
I tried with https:// but I get from Postman:
Could not get any response There was an error connecting to https://localhost:8081/points/12345/search.
From the moment I wrote
server.ssl.key-store=classpath:KeyStore.jks server.ssl.key-store-password=test
in application.properties
, I get the error message:
Bad Request - This combination of host and port requires TLS
I have deleted all my code in my controller, I just let the endpoint so that I can invoke it.
@RestController @SpringBootApplication public class MainApplication { @RequestMapping(value = "/points/{point}/search", method = RequestMethod.GET) public PointsType getPoint(@PathVariable(value = "point") String point) { System.out.println("hi"); // Never printed return null; } public static void main(String[] args) { SpringApplication.run(MainApplication.class, args); } }
Here is the file application.properties:
spring.application.name=sge server.port=8081 server.ssl.key-store=classpath:KeyStore.jks server.ssl.key-store-password=test server.ssl.key-alias=homologation-staging server.ssl.trust-store=classpath:TrustStore.jks server.ssl.trust-store-password=test server.ssl.client-auth=need security.require-ssl=true server.tomcat.remote_ip_header=x-forwarded-for server.tomcat.protocol_header=x-forwarded-proto
What should I do ?
TLS provides protection for data in transit between client and server and is a key component of the HTTPS protocol. The Secure Sockets Layer (SSL) and TLS are often used interchangeably, but they aren't the same. In fact, TLS is the successor of SSL. TLS can be implemented either one-way or two-way.
I used https://
at the beginning instead of http://
, it worked for me.
I got this message because I was using wrong certificate.
I misunderstood Client certificate and Server certificate.
In my case, I installed my certificate on the server, for my domain, but what I needed to do instead is to use it to make the request, as a client certificate.
you can check it how to do it here.
Client Certificate Authentication with Spring Boot
So this message is basically saying: "Hey, your SSL request is not OK", I can't find the cert file, or your cert file is not the good one, as @SerdarAtalay says, it can also significate that you didn't use https://
prefix, etc.
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With