Host multiple apps on the same server easily
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
example.js
hostify.js

README.md

Hostify

Hostify is a small node.js module that allows multiple apps to run on the same server.
First run hostify:

./hostify.js

This creates a server on port 80 which forwards requests to unix sockets listening in /tmp/hostify based on the Host header in the http request.

// hostify will forward all requests to example.com to this server
require('http').createServer(function(request, response) {
	response.writeHead(200);
	response.end('hello world');
}).listen('/tmp/hostify/example.com.sock'); 

You can also use dns wildcards

// hostify will forward all requests to *.example.com to this server (fx foo.example.com)
require('http').createServer(function(request, response) {
	response.writeHead(200);
	response.end('hello world');
}).listen('/tmp/hostify/*.example.com.sock'); 

To listen in another folder than /tmp/hostify or a different port use the options --sockets and --port