Go to file
Brian Buller deda2ebfb9 Don't route request that we shouldn't!
Oh man, I really hope that's fixed now... What a nightmare.
2016-06-07 17:50:18 -05:00
.gitignore Committed 2016-06-04 16:55:10 -05:00
config.go Committed 2016-06-04 16:55:10 -05:00
hostsplitter.go Don't route request that we shouldn't! 2016-06-07 17:50:18 -05:00
LICENSE hello version control 2016-02-03 22:36:11 -06:00
README.md Change Hostsplitter-Secret to X-Hostsplitter-Secret. Thanks /u/nowprovision 2016-02-05 11:23:13 -06:00
signal_handler.go Committed 2016-06-04 16:55:10 -05:00
site.go hello version control 2016-02-03 22:36:11 -06:00

HostSplitter

HostSplitter is an HTTP reverse proxy and load balancer that distributes requests to an arbitrary amount of sites based on the Host header.

Motivation

I commonly run into an issue developing small golang websites: I want to use the same IP address for many sites that aren't large enough to justify their own server.

Site files

HostSplitter will look for site files by default in "/etc/hostsplitter/". HostSplitter will only read files with the .json extension.

A each site file should look like

{
	"hostnames": [
		"ammar.io",
		"www.ammar.io"
	],
	"backends": [
		"127.0.0.1:9000"
	],
	"secret": "puppies1234"
}

The "secret" field is passed along with every request to that site in the X-Hostsplitter-Secret header. This is intended to be checked before trusting the passed along IP.

Real IP

The original requester's IP is located in the X-Forwarded-For header.

Reloading

HostSplitter provides 0 downtime reload functionality via SIGUSR1. E.g

pkill -10 hostsplitter

Roadmap

  • SSL