The following code successfully creates a reverse proxy server on localhost:8000 which reverse proxies to httpbin.org:
var httpProxy = require('http-proxy');
httpProxy.createProxyServer({target: 'http://httpbin.org'}).listen(8000);
However, if you change http://httpbin.org to any CloudFlare-enabled site (including http://www.cloudflare.com itself), you get "Error 1003 Direct IP access not allowed". Is there some way to configure the proxy server so it can successfully front CloudFlare-enabled sites? Sorry if I'm missing something obvious.
Never mind, seem to have figured it out:
httpProxy.createServer({changeOrigin: true, target: 'http://www.cloudflare.com'}).listen(8000);
Hey, I know it's been 5 years, But it's somehow directing me to the URL instead of staying on the proxy.
Weird. Do you have any idea why?
Most helpful comment
Never mind, seem to have figured it out: