2016-07-08 2 views
2

나는 설정을 잘 작동 리버스 프록시를Cloudflare + 역방향 프록시 오류 때문에 SEO 1000

2)http://blog.example.com (워드는

3) V)에서 GoDaddy에서 호스팅 방문자가 http://www.example.com/blog에 액세스하면 http://blog.example.com에서 콘텐츠를 가져옵니다.

이 벌금과 1에서 작동) 또한 프록시가 인기 nodejitsu HTT-프록시와 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); 

가 그럼 난 그래서 HTTPS를 가질 수 Cloudflare SSL 인증서를 추가했습니다. 나는 Cloudflare가 역방향 프록시로서의 역할을한다는 것을 알고 있습니다. 그래서 전체적으로 셋업, 1), 2) (Cloudflare의 역방향 프록시) 및 3) (내 사용자 정의 역방향 프록시)에서 3 개의 역방향 프록시를 갖게됩니다.

별도로, https로 1) 및 2) 모두 정상적으로 작동했습니다. 그러나 3) 파산. 3

), 나는 오류가 계속 :

오류 1000 - 금지 IP에 DNS 점을

진행되고 어떻게이 문제를 해결하기 위해 진행해야합니까?

답변

3

그래서 CloudFlare DNS가 존 파일의 다른 프록시를 가리키고 있습니다. CloudFlare도 역방향 프록시이므로 enabling a proxy on a record may create a cyclic loop입니다.

이 문제를 해결하려면 Node.js 프록시가 이상적으로 원본 웹 서버를 가리키고 CloudFlare를 통해 돌아 가지 않는 것이 이상적입니다. 스크립트를 업데이트하고 싶지 않으면 서버에서 프록시를 수행하는 웹 서버의 호스트 파일을 업데이트하여 원본 경로에 직접 경로를 추가 할 수 있습니다.

+0

안녕하세요 mjsa, "귀하의 Node.js 프록시가 이상적으로 원점 웹 서버를 가리키고 CloudFlare를 거치지 않아야합니다." node.js reverse-proxy 스크립트를 변경하여 어떻게해야합니까? – user1347271

+0

스크립트를 호스트하는 서버의/etc/hosts 파일을 변경하여 해당 도메인이 원본 서버를 똑바로 가리 키도록하십시오. 그렇지 않으면 스크립트의 도메인 이름 대신 원본 서버에 IP 주소를 사용할 수 있습니다. – mjsa