Error while proxying to blog subdomain from node.js app
I have a nodejs app hosted on heroku at www.example.com Then I 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 homepage at www.example.com/blog - it proxies correctly and transparently to blog.example.com
However, if I go to any of the blog posts it crashes with a 500 error
[error] [client (ipAddressHere)] The request exceeded the 10 internal redirects limit due to a possible configuration error. Use "LimitInternalRecursion" to increase the limit if needed. Use "LogLevel debug" to get backtrace., Referer: http://www.example.com/blog/
I suspect it has something to do with my htaccess - but can't figure out what?
My 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
source to share
Removed / blog from my htaccess to do this:
# 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
Now it works Transparent proxying from my node app to Wordpress blog!
source to share