因为SEO我设置了一个工作正常的反向代理:
设置如下:
1) http://www.example.com(node.js托管在heroku)
2) http://blog.example.com(在godaddy托管的wordpress)
3)访问http://www.example.com/blog的访问者从http://blog.example.com获取内容.
这工作正常,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 …Run Code Online (Sandbox Code Playgroud)