Load balancer for non-80 ports

I ran into issues with the HA proxy config when my HTTP-based service is running on non-web-standard ports.

When accessing such a service, the Host header will include the port number, but the generated config looks at the Host header without the port number.

For example, I have two elasticsearch services, both listening on port 9200. Using a Load balancer I can expose 9200 and route it based on the requested host name. This all works fine, apart from the fact that the Host header has domain:9200, while the ha proxy config has acl x_host hdr(host) -i domain. In order for this to work, it will need a acl x_host hdr(host) -i domain:9200 line.

I’ve submitted a PR for this, which I hope you’ll be able to accept :smile:

On a ha proxy config related note, is there any way to customize/tweak the generated config file to ha proxy?

Let’s say I want to use some features that’s not supported by rancher/cattle. (like enable the ha proxy stats for the backends for instance)

@kaos thanks for pointing out the use case, I’ve reviewed the PR and posted some comments.

Haproxy config manual modifications is not something Rancher supports. Even if you modify it manually, Rancher will override it on the next LB modification (target addition, etc). But you can always file an enhancement request if you need a certain LB functionality - we might as well implement if it happens to be a common use case :slight_smile:

@kaos update on the PR - we are planning to include it to the next Rancher release, thanks for contributing!

@alena excellent, thank you.

Right now I can only think of being able to enable the stats module in haproxy, and then it would make sense to have more descriptive labels for the servers in the config. But I don’t know it that well, perhaps @andre_knutas can describe better what we’d like here… :wink: