Unable to configure working Proxy

Hello everyone,

I’m struggling to solve an issue regarding the correct configuration of Electron proxy. I already asked this question on stackoverflow so here is the link.

Long story short, I’m failing to setup proxy using this:

//main.ts
win.webContents.session.setProxy({
  pacScript: url.format({
    pathname: path.join(__dirname, 'proxy.pac'),
    protocol: 'file:',
    slashes: true,
  }),
});

//proxy.pac
function FindProxyForURL(url, host) {
  if (shExpMatch(host, '*services-dynamic*')) {
    return 'PROXY 127.0.0.1:8181';
  }

  return 'DIRECT';
}

Any idea what I’m doing wrong?

I forgot, I’m using electron 6.0.7