LocalHost Multiplexer

LHM is a simpler request multiplexer that acts as a reverse proxy based on the delivered hostname. They main purpose is to allow developers to setup a domain space in their host file or as part of a custom DNS setup.

It binds to localhost:80 and redirects the requests based on hostname rules to other ports on localhost.

Using modifications of the /etc/hosts file this allows a developer to use a domain name without actually requiring an internet connection and binding together several services without having to fiddle with a full blown HTTP server.

How to Install

To install simply use go install as following:

go install bitbucket.org/tscs37/lhm/lhm-serve

Then use the command lhm-serve to start the program

Note: You need root privilege to bind to port 80.

How to configure

LHM is configured by writting a short TOML formatted configuration file in the working directory (preferably where your application resides).

Create the file lhm.toml and use the following format:

port = 80

host = "example.org"
target = 8080

host = ["www.initech.com", "initech.com"]
target = 8081

In the example LHM will now proxy all incoming requests for host example.org to [::1]:8080 and all incoming requests for the hosts www.initech.com and initech.com to [::1]:8081.