eitann
eitann

Reputation: 1270

net:ERR_CONNECTION_RESET from a specific website in electron app

I Have an Electron app with a Webview. When i set the webview src to the website https://www.zap.co.il i'm receiving the error: net:ERR_CONNECTION_RESET. The weird things are:

  1. It's happening only for that website, i'm not receiving this error from any other website.
  2. I'm able to reach the website from any other browser on my computer (Chrome, Chromium).
  3. This is happening in both Windows and Mac platforms.
  4. A colleague of mine have the same App installed on her computer, and she is experiencing the same behaviour from a different computer (and network)

There is no antivirus Installed that may intercept and no proxy configured. I have tried to reset the network, clear cache and cookies, change the MTU and basically any solution i found on the internet, and since it's happening for my colleague too, i suppose it has nothing to do with a network issues. And since i can reach the website from other browsers, I think the issue is probably relates to Electron.

I'm Using the versions:

Upvotes: 2

Views: 3954

Answers (1)

eitann
eitann

Reputation: 1270

The problem was that electron add's few properties to the user agent string. and this specific website is not accepting custom properties in the user agent (probably for security reasons). I fixed it by removing the additional properties from the webview's user agent:

webview.addEventListener('dom-ready', () => {
    const uaArr = webview.getUserAgent().split(" ");
    const newUaArr = uaArr.filter((uar => !uar.startsWith('Electron')));
    webview.setUserAgent(newUaArr.join(" "));
});

Upvotes: 3

Related Questions