Search code examples
mongodbwebfaction

Connect to MongoDB sub-path


I'm trying to set up mongodb on webfaction. It works fine, currently running on port 36505 on the server. I can connect to it on the server just fine. But per the firewall, I can't connect to 36505 on the server from the 'net.

I can expose the port by mapping the port to port 80 under a sub-path. So I can make 1.1.1.1:36505 to 1.1.1.1:80/mongodb

My question is how do I actually connect to that? I'm not sure if mongo supports subpaths on port 80 or not...


Solution

  • The problem with what you are doing here is that the WebFaction firewall will prevent direct connections to your MongoDB instance because it isn't speaking straight HTTP and you don't have access to make it use port 80. The simple fix for this is to get a dedicated IP address and then have the support team open a hole in the firewall in order for you to connect directly to the database that way.

    Here is an example on the WebFaction community page:

    http://community.webfaction.com/questions/3448/using-websockets-with-a-nodejs-custom-app