HAProxy config for domain forwarding
-
Hi,
I need to forward traffic to different backend servers based on the TLD/Path. I've installed HAProxy and used one of the examples as a guide, but it's not working as expected. The two domains are:
wss://blah.example.com:7000/device/ws/
https://blah.example.com:7000/api/v2/device/I have the backends configured in HAProxy. The issue is the frontend is sending all traffic to one backend. I've tried host starts with: with values of wss and https. Next I tried path contains: and used values ws and API. Neither worked.
Suggestions?
-
@gcjh01 said in HAProxy config for domain forwarding:
wss://blah.example.com:7000/device/ws/
https://blah.example.com:7000/api/v2/device/I have the backends configured in HAProxy. The issue is the frontend is sending all traffic to one backend. I've tried host starts with: with values of wss and https.
These values are just the schemes, but not part of the hosts.
The host is "blah.example.com" in both cases. So if you have no other hosts on public port 7000 you don't need to configure an ACL for it.Just add an ACL with "Path starts with:" "/device/ws" and a second with "Path starts with:" "/api/v2/device". Then add an action for each to use the desired backend.
However, I don't know if HAproxy even works with Websockets.
-
@viragomann Thanks. I tried your suggestions, yet all traffic still goes to the was://blah.example.com/...
When I enter https://blah.example.com:7000/api/v2/device in a browser the response come from the websocket (was://)