[Qtwebengine] Add way to override host resolution

Manuel Peinado manuel.peinado at gmail.com
Thu Feb 14 16:25:23 CET 2019

Hi all,

We have this app we’re working on at Plex that’s written in QML and makes
heavy use of WebEngineView. In order to implement our secure connections
feature (see
we would need to hook into Chromium's DNS resolution. The goal is pretty
simple, basically detect if the host has a particular structure and resolve
it to a custom IP in case it does.

So assuming Qt had support for this, we would be doing something like the

QQuickWebEngineProfile* webEngineProfile = ...;
webProfile->setHostResolver(new CustomHostResolver());

Where CustomHostResolver would implement an interface similar to the
existing QWebEngineUrlRequestInterceptor:

class CustomHostResolver : public QtWebEngineHostResolver


 void resolveHost(QWebEngineHostResolutionInfo& info) override
   if (info.host == "special host name")
     info.resolveHostTo("custom IP");

   // If we don't modify "info" then the host gets resolved
   // using the default, DNS based, path.

There is no support at the moment for any of this in QtWebEngine, so we
would have to add it ourselves. And here's the question: if we create a PR
that implements this, would it have any chance of getting reviewed and
ultimately accepted? Just want to make sure it stands a chance before we
spend a bunch of time working on it.

(I've studied the underlying code and think we would be able to implement
what we need without requiring any patches to Chromium, which should
improve the chances that the PR succeeds right?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20190214/96bb9e93/attachment.html>

More information about the QtWebEngine mailing list