Help on Switching backend on TCP mode



I’m trying to redirect a tcp traffic based on a regex but it isn’t working. The client app opens a socket and send the message. I need to switch it depending on the content.
Can anyone give me a help!?

frontend switching


log-format [%t]\ from\ %ci:%cp\ to\ %fi:%fp\ %si:%sp\ %s\ %ts\ request_size=%U\ response_size=%B

acl acl_system2 req.payload(0,0) -m reg -i (.+)(06SWITCH)(.*)

use_backend system2 if acl_system2
use_backend system1


I also don’t know the size of the payload it may differ between different requests…


Were you able to solve this? I am having similar issues.


If your content is binary (non-ascii), string matching might not work (no idea why, but have seen it in practice).
Try matching hex instead:

# Substring in hexadecimal
req.payload(0,0),hex -m sub 3036535749544348   # 06SWITCH in hex format