I have setup a proxy server to an exist website with http-proxy-middleware, but the server is really slow, checkout the waterfall with Chrome development tools, a lot of requests have Stalled status.
I try to increase maxSockets with https.Agent, the behavior is the same. The code like blow:
const express = require('express');
const proxy = require('http-proxy-middleware');
const app = express();
const https = require('https');
const originDomain = 'example.com';
const appPort = 8080;
app.use('/',
proxy({
target: 'https://' + originDomain + '/',
secure: false,
changeOrigin: true,
logLevel: 'debug',
agent: new https.Agent({
maxSockets: 100
})
})
);
app.listen(appPort, () => {
console.log('Proxy listening on port ' + appPort);
});