While accessing our own website in Java code, an exception is thrown:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching en.greatfire.org found.
However, when accessing it in a browser or using curl, there's no problem.
Any idea why this could be? If there's any problem with our certificates but browsers are somehow more lenient we'd like to fix it.
Not sure if it's related, we have separate certificates for greatfire.org and en.greatfire.org.
Java code that throws the above exception:
URL url = new URL("https://en.greatfire.org");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
System.out.println("Response code: " + conn.getResponseCode());
for(Entry<String, List<String>> header : conn.getHeaderFields().entrySet()) {
for(String headerValue : header.getValue()) {
System.out.println(header.getKey() + ": " + headerValue);
}
}