Bad Request This Combination Of Host And Port Requires Tls., Bad Request

I”m trying to make a https call to a service, I have a Privake key to secure connection.

You are watching: This combination of host and port requires tls.

I hit:

http://localhost:8081/points/12345/searchI tried with https:// but I get from Postman:

Could not get any responseThere was an error connecting to https://localhost:8081/points/12345/search.From the moment I wrote

server.ssl.key-store=classpath:KeyStore.jksserver.ssl.key-store-password=testin, 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.

SpringBootApplicationpublic 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) {, args); }}Here is the file should I do ?

spring-boot ssl
Improve this question
edited Oct 29 “19 at 9:15
asked Oct 28 “19 at 17:13


15.3k3131 gold badges125125 silver badges255255 bronze badges
| Show 4 more comments

4 Answers 4

Active Oldest Votes
I used https:// at the beginning instead of http://, it worked for me.

Improve this answer
edited Jul 16 at 14:05


22.5k44 gold badges1414 silver badges3636 bronze badges
answered Feb 19 “20 at 11:11


48666 silver badges55 bronze badges
Add a comment |
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.

See more: What Is The Meaning Behind ” So Happy I Could Die Lady Gaga, So Happy I Could Die

Hope it helps!

Improve this answer
answered Jun 17 “20 at 14:06


15.3k3131 gold badges125125 silver badges255255 bronze badges
Add a comment |
We can fix this by either of below listed solutions.

Use HTTPS instead of HTTPDisable TLS encryption from POSTMAN setting and use HTTPCheck application properties server.ssl.enabled= true- HTTPS , false-HTTP

<1>: image description here

Improve this answer
answered Sep 8 at 18:53


2111 bronze badge
Add a comment |
I had this issue when working on a Java Project in Debian 10 with Tomcat as the application server.

The issue was that the application already had https defined as it”s default protocol while I was using http to call the application in the browser.

I however tried using the https protocol in the browser but it didn”t connect throwing the error:

Secure Connection Failed

An error occurred during a connection to SSL received a record that exceeded the maximum permissible length.


The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.Please contact the website owners to inform them of this problem.

Here”s how I solved it:

I first had to create a keystore file for the application, more like a self-signed certificate for the https protocol:

sudo keytool -genkey -keyalg RSA -alias tomcat -keystore /usr/share/tomcat.keystoreNote: You need to have Java installed on the server to be able to do this. Java can be installed using sudo apt install default-jdk.

See more: Molecular Oxygen (O2) Has What Role In Aerobic Cellular Respiration? ?

Next, I added a https Tomcat server connector for the application in the Tomcat server configuration file (/opt/tomcat/conf/server.xml):

sudo nano /opt/tomcat/conf/server.xmlAdd the following to the configuration of the application. Notice that the keystore file location and password are specified. Also a port for the https protocol is defined, which is different from the port for the http protocol:

So the full server configuration for the application looked liked this in the Tomcat server configuration file (/opt/tomcat/conf/server.xml):

This time when I tried accessing the application from the browser using:

https://my-server-ip-address:https-portIn my case it was:

https: worked fine. Although, I had to accept a warning which added a security exception for the website, since the certificate used is a self-signed one.


Leave a comment

Your email address will not be published. Required fields are marked *