I have a Node.js app on an Apache server (that is hosting other non-node.js sites). Here's the Apache setup to send all the traffic on www.mysite.com to Node on port 12001:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.mysite.com
ServerAlias mysite.com www.mysite.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:12001/
ProxyPassReverse http://localhost:12001/
</Location>
ErrorLog /var/log/apache2/mysite-error_log
TransferLog /var/log/apache2/mysite-access_log
</VirtualHost>
And I would like to force all people visiting mysite.com to be redirected to www.mysite.com.
In Node, I can't check req.headers.host
as it always equals localhost:12001
and I'm not sure where I'm supposed to put any .htaccess
file.