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.