简体   繁体   English

Cloudflare +反向代理-错误1000

[英]Cloudflare + Reverse Proxy - Error 1000

because of SEO I have setup a reverse proxy that works fine: 由于搜索引擎优化,我设置了一个反向代理,可以正常工作:

The setup is as follows: 设置如下:

1) http://www.example.com (node.js hosted at heroku) 1) http://www.example.com (nodeoku.js托管在heroku上)

2) http://blog.example.com (wordpress hosted at godaddy) 2) http://blog.example.com (由Godaddy托管的wordpress)

3) visitors accessing http://www.example.com/blog get content from http://blog.example.com . 3)访问http://www.example.com/blog的访问者从http://blog.example.com获得内容。

This works fine and at 1) I also have the proxy working with the popular nodejitsu htt-proxy and httpProxyRules modules: 这工作正常,并且在1)我也有使用流行的nodejitsu htt-proxy和httpProxyRules模块的代理:

// Set up proxy rules instance 
var proxyRules = new httpProxyRules({
    rules: {
      '.*/blog': 'https://blog.example.com', // Rule (1) 
    },
    default: 'https://www.example.com' // default target 
});

// Create reverse proxy instance 
var proxy = httpProxy.createProxy();

// Create http server that leverages reverse proxy instance 
// and proxy rules to proxy requests to different targets 
http.createServer(function(req, res) {
    // a match method is exposed on the proxy rules instance 
    // to test a request to see if it matches against one of the specified rules 
    var target = proxyRules.match(req);
    if (target) {
      return proxy.web(req, res, {
        target: target,
        changeOrigin: true,
      });
    }

    res.writeHead(500, { 'Content-Type': 'text/plain' });
    res.end('The request url and path did not match any of the listed rules!');

}).listen(6010);

Then I tried adding Cloudflare SSL certificates so I could have https. 然后,我尝试添加Cloudflare SSL证书,以便可以使用https。 I know that Cloudflare acts as a reverse-proxy itself. 我知道Cloudflare本身就是反向代理。 So in total I would have 3 reverse-proxies in my setup, 1), 2) (both with Cloudflare's reverse-proxy) and 3) (my custom reverse-proxy). 因此,总的来说,我的设置中将有3个反向代理,分别为1),2)(均带有Cloudflare的反向代理)和3)(我的自定义反向代理)。

Separately, both 1) and 2) worked fine with https. 另外,1)和2)与https都可以正常工作。 However, 3) broke. 但是,3)坏了。

For 3), I keep getting the error: 对于3),我不断收到错误:

Error 1000 - DNS points to prohibited IP 错误1000-DNS指向禁止的IP

What is going on and how should I proceed to solve this problem? 怎么回事,我应该如何继续解决这个问题?

So, you are pointing your CloudFlare DNS to another proxy in your zone file. 因此,您将CloudFlare DNS指向区域文件中的另一个代理。 Because CloudFlare is also a reverse proxy, enabling a proxy on a record may create a cyclic loop . 由于CloudFlare还是反向代理, 因此在记录上启用代理可能会创建循环循环

In order to resolve this, your Node.js proxy should ideally point straight to the origin web server and not go back through CloudFlare. 为了解决此问题,理想情况下,您的Node.js代理应直接指向原始Web服务器,而不要通过CloudFlare返回。 If you don't want to update your script, on the server you might be able to add direct routes to your origins by updating the hosts file on the web server doing the proxying. 如果您不想更新脚本,则可以在服务器上通过执行代理更新Web服务器上的主机文件来向原点添加直接路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM