Page MenuHomeVyOS Platform

Allow to bind haproxy service to interface
Open, WishlistPublicFEATURE REQUEST

Description

Summary

Add support to bind haproxy service to specific interface

Use case

I would like to bind the same port on multiple interfaces.
An example would be to bind port 80/443 for both haproxy and also for a container on a loopback interface

Additional information

In my case I can't just specify the wan address for the listen-address as a workaround because the wan address is dynamically assigned via PPPoE

The documentation for the bind settings interface option is found here: https://docs.haproxy.org/3.1/configuration.html#5.1-interface

The examples shown below all use port 80.

The configuration should probably be added downstream of listen-address, as a single bind setting can support one bind address and one interface.
This would require to also allow wildcards for the listen-address for my use case like this:

set load-balancing haproxy service pppoe0-v4v6 listen-address 0.0.0.0 listen-interface pppoe0
set load-balancing haproxy service pppoe0-v4v6 listen-address [::] listen-interface pppoe0

This would allow to bind to IPv4 or IPv6 addresses of a interface as required by the user.
The generated bind settings would look like this:

bind 0.0.0.0:80 interface pppoe0
bind [::]:80 interface pppoe0

Additionally there could also be an option to bind to both v4 and v6 on the same interface:

set load-balancing haproxy service pppoe0-v4v6 listen-address any listen-interface pppoe0

This would generate a bind setting like this:

bind [::]:80 v4v6 interface pppoe0

When the configuration option is added like this it should also be perfectly compatible to all existing configs.

An alternative would be to add the listen-interface on the same level as the listen address and add the interface option to all bind settings. I discarded this idea as this would limit the flexibility because a service could then only support a single interface.

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)