HTTPS request error while using network proxy
Solved
General and Desktop
-
hi,
I want to analyze https stream data. I create a proxy server by QTcpServer and QSslSocket, but after I set up proxy to my server and request www.example.com, I got ssl error:m_networkManager = new QNetworkAccessManager(this); QNetworkProxy proxy(QNetworkProxy::HttpProxy); proxy.setHostName(proxyHost); proxy.setPort(9999); m_networkManager->setProxy(proxy); QNetworkConfiguration networkConfiguration = m_networkManager->configuration(); networkConfiguration.setConnectTimeout(3000); m_networkManager->setConfiguration(networkConfiguration); connect(m_networkManager, &QNetworkAccessManager::sslErrors, this, [this](QNetworkReply *reply, const QList<QSslError> &errors){ qDebug() << reply << errors; });
QNetworkReplyHttpImpl(0x19b6e5ff990) ("The host name did not match any of the valid hosts for this certificate")
my certificate is created by openssl:
openssl genrsa -out privkey.pem 2048 openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095 -config openssl.cnf
what does 'The host name' and the 'the valid hosts' means? and where can I find it or change it?
thank you so much!
-
Hi,
When you create a certificate you have to give informations like for which host it will be valid. From the looks of it, you did not do that.
-
Usually the final target. Then it depends on your proxy.