redirecting in node.js behind mod_rewrite proxy

Posted by chmanie on Pro Webmasters See other posts from Pro Webmasters or by chmanie
Published on 2013-07-02T14:49:49Z Indexed on 2013/07/02 17:15 UTC
Read the original article Hit count: 347

Filed under:
|
|

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?

© Pro Webmasters or respective owner

Related posts about apache

Related posts about mod-rewrite