I like to redirect a web request to an internal server on a different port. On pfSense I was able to achieve this with the dns resolver and haproxy functionality.
I tried the following on vyos, but could not get it to work:
set load-balancing haproxy service http mode ‘tcp’
set load-balancing haproxy service http port ‘80’
set load-balancing haproxy service http rule 1 domain-name ‘xx.xxxx.local’
set load-balancing haproxy service http rule 1 set backend ‘bk-api-01’
set load-balancing haproxy backend bk-api-01 description ‘bk-api-01’
set load-balancing haproxy backend bk-api-01 mode ‘tcp’
set load-balancing haproxy backend bk-api-01 server api01 address ‘192.168.0.2’
set load-balancing haproxy backend bk-api-01 server api01 port ‘8777’
I also tried with the dns forwarding function in addition.
Would appreciate your support, as this is the last missing piece on my pfsense to vyos migration.
I solved it using the combination of dns forwarding and reverse-proxy as per below:
set service dns forwarding authoritative-domain xxxx.local records a xx address 192.168.0.1
set load-balancing reverse-proxy service http description ‘bind app listen on 80 port’
set load-balancing reverse-proxy service http mode ‘tcp’
set load-balancing reverse-proxy service http port ‘80’
set load-balancing reverse-proxy service http rule 1 domain-name ‘xx.xxxx.local’
set load-balancing reverse-proxy service http rule 1 set backend ‘bk-api-01’
set load-balancing reverse-proxy backend bk-api-01 description ‘My API-1’
set load-balancing reverse-proxy backend bk-api-01 mode ‘tcp’
set load-balancing reverse-proxy backend bk-api-01 server api01 address ‘192.168.0.2’
set load-balancing reverse-proxy backend bk-api-01 server api01 port ‘xxxx’