0

Background:

  • Site 1 - Tomcat
  • Site 2 - IIS

Both sites sit on a single windows server. Both sites accessible in different DNS:

  • site1.com
  • site2.com

Accessing site1.com goes forwards to IIS (I think) then I use URL rewrite in IIS to forward site1.com requests to localhost:8080.

Finally, both sites are accessible in HTTPS on browsers and both sites have valid SSLs.

The problem:

Site1 usually makes REST API calls to site2. Site1 calls site2 using Java HttpClient (HttpGet and HttpPost). But when it does, error occurs and logs shows error below:

javax.net.ssl.SSLException: hostname in certificate didn't match: <site2> != <site1> OR <site1>

Can someone please help and shed some light please? Or if there's any other suggestion on what to use.

Eugène Adell
  • 3,089
  • 2
  • 18
  • 34
Jan
  • 25
  • 3
  • have a look at this : https://stackoverflow.com/questions/2703161/how-to-ignore-ssl-certificate-errors-in-apache-httpclient-4-0 – Eugène Adell Feb 25 '18 at 19:10
  • @EugèneAdell I think this is not the right thing to do in Production environment. – Jan Feb 26 '18 at 01:19
  • You didn't say it was for production use, and you asked for suggestions. Have a look at granko87's answer here : https://stackoverflow.com/questions/7256955/java-sslexception-hostname-in-certificate-didnt-match. Maybe should you check that your DNS is resolving everything correctly too. – Eugène Adell Feb 26 '18 at 08:57

0 Answers0