I'm trying to set up a proxy for my Node.js server on my EC2 instance, so I can access it through something like http://*.amazonaws.com/node
, where * is the rest of the URI. I've set up the proxy by editing /etc/httpd/conf/httpd.conf
with the following:
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /node http://*.amazonaws.com:3000
ProxyPassReverse /node http://*.amazonaws.com:3000
My Node.js server.js file looks like this:
var port = process.env.PORT || 3000;
var host = '*.amazonaws.com' || process.env.HOST || '127.0.0.1';
So when I have everything up and running, I can access /node, however, the Node.js's /public directory is not being used as the Document's root directory, so I get 404s for any file index.html includes because it's assuming it's in the /public directory. For example, Firebug reports a 404 for http://*.amazonaws.com/javascripts/rails.js
and 3 other files, which means this is not hitting the Node.js's /public directory.
It's good to note if I edit the paths in the index.html file, everything works, but I would rather not have to do that... also, if I take out the ProxyPass config in httpd.conf, and just access the node server from http://*.amazonaws.com:3000
, it works... but ideally, I'd like to not have to do that and be able to do /node.
What I want to know is, is my proxy configured correctly, and if not, how do I go about fixing it so when I access /node, all of the requested files get redirected themselves?