redirecting in node.js behind mod_rewrite proxy
- by chmanie
I have a node.js application running behind an Apache mod_rewrite proxy configured in a .htaccess file like this:
RewriteCond %{HTTP_HOST} =mydomain.com [OR]
RewriteCond %{HTTP_HOST} =www.mydomain.com
RewriteRule (.*) http://localhost:3000/$1 [QSA,P]
When I now do a redirect (e.g. express' res.redirect()) inside my node.js application (which runs on port 3000), the user is always redirected to http://localhost:3000/ (which is in fact exactly what is defined above but not the desired behaviour).
Is there any way around this?