我有一个nodejs应用程序托管在Heroku上,在www.example.com 然后,我有一个词preSS博客,目前一个子 - blog.example.com
我有一个路由建立在EX preSS:
(使用 EX preSS-HTTP代理)
VAR代理=需要('EX preSS-HTTP代理);
app.use('/博客',代理服务器(blog.example.com',{
forwardPath:功能(REQ,RES){
返回要求(URL)解析(req.url)。路径。
}
}));
这工作,在这个意义上,我可以看到在www.example.com/blog的博客主页 - 这是正确的,并transparnelty代理到blog.example.com
不过,如果我访问任何对那里的博客文章,它落在了一个500错误
[错误] [客户端(ipAddressHere)请求超过了10内部重定向的限制,由于可能的配置错误。使用'LimitInternalRecursion'如果有必要提高限制。使用LogLevel的调试,以得到一个回溯,引用者: http://www.example.com/blog/
我怀疑它是与我的htaccess的 - 但不能完全弄清楚什么
我的htaccess是:
#BEGIN字preSS
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /博客/
重写规则^指数 .PHP $ - [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则。 /blog/index.php [L]
< / IfModule>
#结束字preSS
解决方案
这是我的htaccess删除/博客,使之:
#BEGIN字preSS
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /
重写规则^指数 .PHP $ - [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则。的index.php [L]
< / IfModule>
#结束字preSS
现在它的工作原理 透明代理从我的节点应用程序/博客,字preSS博客!
I have a nodejs app hosted on heroku, on www.example.com I then have a wordpress blog, currently on a subdomain - blog.example.com
I have a route setup in express:
(using 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;
}
}));
This works, in the sense that I can see the blog "home page" on www.example.com/blog - it's proxying correctly and transparnelty to blog.example.com
However, if I visit any of the blog posts on there, it falls over with a 500 error
[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/
I suspect it’s something to do with my htaccess - but can’t quite figure out what?
My htaccess is:
# 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
解决方案
Removed /blog from my htaccess to make it:
# 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
It now works Transparent proxying from my node app /blog to wordpress blog!