从 node.js 应用程序代理到博客子域时出错

Error when proxying to blog sub domain from node.js application

我在 www.example.com 上的 heroku 上托管了一个 nodejs 应用程序 然后我有一个 wordpress 博客,目前在一个子域上 - blog.example.com

我在 express 中设置了路线:

(使用 express-http-proxy

var proxy = require('express-http-proxy');

app.use('/blog', proxy('blog.example.com', {
    forwardPath: function(req, res) {
        return require('url').parse(req.url).path;
    }
}));

这有效,因为我可以在 www.example 上看到博客 "home page"。com/blog - 它正确地代理并透明地传输到 blog.example.com

但是,如果我访问那里的任何博客文章,它就会因 500 错误而失败

[error] [client (ipAddressHere)] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://www.example.com/blog/

我怀疑这与我的 htaccess 有关 - 但不太清楚是什么?

我的 htaccess 是:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

从我的 htaccess 中删除了 /blog 以使其成为:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

现在有效 从我的节点应用程序/博客到 wordpress 博客的透明代理!