QWebEnginePage is doing DNS queries locally, despite having a proxy set
Unsolved
QtWebEngine
-
As a proof-of-concept I have set-up
squid
server on a Linux box and usedngrok
to put it behind TLS. When I set this proxy up in Chrome (using Oxylabs Proxy Extension) I see no DNS queries happening locally, regardless of the site I visit (including the O365 auth page). However when using the same proxy set-up for my Qt app, I am seeing DNS queries on the proxy machine and DNS queries on the Windows machine.(I am using Wireshark to check for DNS queries on the Windows machine and
tcpdump
to check for DNS queries on the Linux machine)Is it possible to make
QWebEngine
act more like Chrome?Here is the code, which I think is pretty standard
auto const& proxyHost = ...; auto const& proxyPort = ...; auto const& proxyUsername = ...; auto const& proxyPassword = ...; _networkProxy.setType(QNetworkProxy::HttpProxy); _networkProxy.setHostName(proxyHost); _networkProxy.setPort(quint16(proxyPort)); _networkProxy.setUser(proxyUsername); _networkProxy.setPassword(proxyPassword); QNetworkProxy::setApplicationProxy(_networkProxy); auto const& authUrl = ...; _webProfile = new QWebEngineProfile(this); auto* settings = _webProfile->settings(); settings->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false); settings->setAttribute(QWebEngineSettings::LinksIncludedInFocusChain, false); settings->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false); settings->setAttribute(QWebEngineSettings::NavigateOnDropEnabled, false); _webView = new QWebEngineView(this); _webPage = new QWebEnginePage(_webProfile, this); _webView->setPage(_webPage); auto* gridLayout = new QGridLayout; gridLayout->setContentsMargins(0, 0, 0, 0); gridLayout->addWidget(_webView); setLayout(gridLayout); _webPage->load(authUrl); show(); setFocus();
Is there anything more I can do to make sure the DNS queries are not leaked locally?