OptimalBits/redbird — pull request #7 by tcoats (2014-10-13 19:41:28+00:00)
Title: Added configuration option for passing hostheader from source

The host header of the target is currently used for proxy requests by default. This is great for pulling together existing websites into better url structures, and to mimic the functionality of existing services at different urls. However if redbird is used to provide https and load balancing then the source host header is the one that is wanted to pass through. The target may be nodejs running in a high port range. Because websites run in different environments it's common practice to use the host header itself for construction of urls and the nodejs server won't have knowledge of the actual external host unless the host header from the source is passed through.

I believe there are three solutions:

1. If the target is an IP address use the host header from the source.
2. Create a configuration option for using the target's host header - by default use the source host header.
3. Create a configuration option for using the source host header - by default use the target host header.

The first option is a little mysterious and not immediately obvious, code should probably be explicit so I would suggest not going with IP address detection.

I would select options 2 or 3 depending on the intended use of redbird. If redbird is a load balancer / proxy server for pulling together nodejs web servers then I would go with option 2. If redbird is a tool to compose existing services then I would go with option 3.

I've implemented option 2 as I suspect redbird is primarily suited to load balancing nodejs web servers.