When using proxy object to access both HTTP and HTTPS, HTTP works fine until an HTTPS request is sent through the object, at which point only HTTPS works and HTTP hangs with error: _Protocol "http" not supported. Expected "https"._ This behavior is confusing and costly to debug, and likely is caused by a state being set within http-proxy that cannot be reversed once an HTTPS request is initiated.
module.proxy = httpProxy.createProxyServer();
module.proxyssl = httpProxy.createProxyServer();
if ( req.secure )
module.proxyssl.web(req,res,options);
else
module.proxy.web(req,res,options);
I have the same issue here, seems not well explained in the docs.
Most helpful comment
I have the same issue here, seems not well explained in the docs.