Route traffic by destination port


I would like to know if it’s possible to route the traffic by destination port to the same server and port ?

For example :

frontend tcp_balancing
mode tcp
bind    *:9000
bind    *:9001

use_backend tcp_9000   if dst-port int(9000)
use_backend tcp_9001   if dst-port int(9001)

backend tcp_9000
    mode tcp
    server myserver check

backend tcp_9001
    mode tcp
    server myserver check

This should do the job:

use_backend tcp_9000   if { dst_port 9000 }
use_backend tcp_9001   if { dst_port 9001 }

thanks a lot

1 Like