Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Direct IP access not allowed" when reverse proxying to CloudFlare domain #779

Closed
requiredfield opened this issue Feb 19, 2015 · 4 comments

Comments

@requiredfield
Copy link

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.

@requiredfield
Copy link
Author

Never mind, seem to have figured it out:

httpProxy.createServer({changeOrigin: true, target: 'http://www.cloudflare.com'}).listen(8000);

@masasidan
Copy link

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?

@adamchipperfield
Copy link

I'm getting the same as @iDanii...

@piyushkmr
Copy link

I think it might be due to http->https redirection.
If you are proxying in this way myserver->HTTP://external-server.
And external server is configured to auto forward HTTP to https, then it will return https://external-server in its location-header.
Now you browser will 301 to https://external-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants