title: Electron interceptBufferProtocol proxying requests does not work
body: <p>Using interceptBufferProtocol, I can successfully intercept the loadURL event to <a href="https://google.com" rel="nofollow noreferrer">https://google.com</a> <code>mainWindow.loadURL("https://google.com/");</code> and replace it with my custom HTML code. The HTML code has an iframe which I am trying to proxy. This can usually be achieved by setting the electron browserWindow proxy but in my case, it fails to work. I set the proxy with the following code: </p>
  
  <pre><code>mainWindow.webContents.session.setProxy({
                  proxyRules: "http://" + proxy
              }, () =&gt; {
                  console.log('Proxy: http://' + proxy)
          }) 
  </code></pre>
  
  <p>Intercept url code:</p>
  
  <pre><code>ses.protocol.interceptBufferProtocol('https', (req, callback) =&gt; {
  ses.resolveProxy(req.url, (x) =&gt; {
      console.log(x)
  })
  if (req.url == "https://google.com/") {
      fs.readFile(path.join(__dirname, "/../../path/stuff.html"), 'utf8', function(err, html) {
          callback(Buffer.from(html, 'utf8'));
      });
  } else {
      const request = net.request(req)
      request.on('response', res =&gt; {
          const chunks = []
  
          res.on('data', chunk =&gt; {
              chunks.push(Buffer.from(chunk))
          })
  
          res.on('end', async () =&gt; {
              const file = Buffer.concat(chunks)
              callback(file)
          })
      })
  
      if (req.uploadData) {
          req.uploadData.forEach(part =&gt; {
              if (part.bytes) {
                  request.write(part.bytes)
              } else if (part.file) {
                  request.write(fs.readFileSync(part.file))
              }
          })
      }
      request.end()
  }
  </code></pre>
  
  <p>})</p>
  
  <p>However, no matter what I do, it appears to use my local IP instead of a proxy. Do I have any options?</p>
  
  <blockquote>
    <p>The code runs fine without a proxy. I'm trying to run it with one. The problem lies within the .interceptBufferProtocol() function. Any help would be appreciated!</p>
  </blockquote>