ERR_TOO_MANY_RETRIES when proxying through https localhost to another https domain

Viewed 603

I run a local HTTPS server that uses fake certificates, (same as webpack-dev-server's approach for https), and uses node-http-proxy to proxy to another domain.

~10% of the requests randomly drop with ERR_TOO_MANY_RETRIES error. Looks like the requests drop on the browser side - they don't seem to reach the server at all.

This happens only on Chrome and a specific domain, but doesn't happen in other browsers or on other domains (even https://www.google.com).

I saw reports of ERR_TOO_MANY_RETRIES related to LastPass, so I created a new profile for Chrome to ensure no extensions are running, and the issue still occurs.

I'm trying to understand where the root cause is. Is it the proxy/ssl handshake/server config?

const { createServer } = require("https");
const fakeHttpsCert = require("fake-https-cert");

const httpProxy = require("http-proxy");

const proxy = httpProxy.createProxyServer({
  target: "https://example.com",
  changeOrigin: true,
  secure: false,
});

const fakeCert = fakeHttpsCert(console);
const ssl = { key: fakeCert, cert: fakeCert, requestCert: false };

createServer(ssl, (req, res) => {
  proxy.web(req, res);
}).listen(4001);

Dropped requests in Console

0 Answers
Related