HTTPS 主机名错误:应该是 <sub.domain.com>.这是什么原因造成的? [英] HTTPS hostname wrong: should be &lt;sub.domain.com&gt;. What causes this?

查看:18
本文介绍了HTTPS 主机名错误:应该是 <sub.domain.com>.这是什么原因造成的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用 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.

我使用以下代码连接

    // 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 证书似乎已授予 sub.domain.com.或者,更可能的是,在没有更新 SSL 证书的情况下,domain.com 已重命名为 sub.domain.com.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆