HTTPS主机名错误:应为< sub.domain.com> ;.是什么原因造成的 [英] HTTPS hostname wrong: should be <sub.domain.com>. What causes this?
问题描述
当尝试使用https连接到服务器时,我收到此HTTPS主机名错误:错误。我的网址看起来像这样
I am getting this 'HTTPS hostname wrong:' error when trying to connect to a server using https. My url looks something like this
https://sub.domain.com/tamnode/webapps/app/servlet.
我使用以下代码进行连接
I connect using the following code
// Create a URLConnection object for a URL
URL url = new URL(requestedURL);
HttpURLConnection.setFollowRedirects(false);
// connect
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("User-Agent", USER_AGENT); //$NON-NLS-1$
OutputStreamWriter wr = new OutputStreamWriter(connection
.getOutputStream());
但是会收到错误
IOException: HTTPS hostname wrong: should be <sub.domain.com>.
at sun.net.www.protocol.https.HttpsClient.checkURLSpoofing
....
这是过去工作但不再是工作的代码。系统架构有一些变化,但是在接近负责人之前,我需要获得更多的数据。
This is code which has worked in the past but no longer. There have been some changes to the system architecture but I need to get more data before approaching those responsible.
什么可能导致此错误?我可以关闭URLSpoofing检查吗?
What can cause this error? Can I turn off the URLSpoofing check?
推荐答案
看起来domain.com的SSL证书已经被授予子域名.COM。或者更有可能的是,domain.com已被重命名为sub.domain.com而不更新SSL证书。
It looks like the SSL certificate for domain.com has been given to sub.domain.com. Or, more likely, what was domain.com has been renamed to sub.domain.com without updating the SSL certificate.
这篇关于HTTPS主机名错误:应为< sub.domain.com> ;.是什么原因造成的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!