Hi Christian,
I had the similar requirement and I had to add the following statement in
order to make it work. I have put comment on the top of each statement.
*# Acl to make haproxy wait till enough information is received from
client to intercept and route*
* acl client_wait req_len gt 28 *
* # Acl to match the data in the payload i.e. match the 28th byte
in the payload *
* # and if it matches hex 32 (ascii char 2) then return success.*
* acl last_msisdn req.payload(28,1) -m bin 32 *
* # Delay the connection for max 10 sec to receive and inspect the
packet and match one of the ACL*
*tcp-request inspect-delay 3s*
*# When payload is received match for acl and accept the connection
if it matches*
* tcp-request content accept if client_wait*
option tcplog
* # Use the tcp-gcp if acl rule names **last_msisdn** matches*
* use_backend tcp-gcp if **last_msisdn*
*Regards,*
*Swapnil*
On Tue, Apr 25, 2017 at 10:28 PM, Christian Rohmann <
[email protected]> wrote:
> Hello haproxy users!
>
> I am trying to get my head around the feature to capture arbitrary
> tcp-request content.
> (I've already found a previous thread - http://haproxy.formilux.narkiv
> e.com/dwcoXP7y/haproxy-with-mqtt where someone asked a something similar
> to extract data from MQTT requests)
>
> In the documentation https://cbonte.github.io/hapro
> xy-dconv/1.5/configuration.html#4.2-tcp-request%20content
> Is says that the action "capture" will allow for samples to be captured.
> In my case I want to capture a few bytes of the payload
> like it's described for acl samples at https://cbonte.github.io/hapro
> xy-dconv/1.5/configuration.html#7.3.5-req.payload .
>
>
> After some trial an error I found that config syntax:
> tcp-request content capture req.payload_lv(3,8) len 8
>
> will at least parse correctly. But how can I access the captured bytes
> later to i.e. log them to the access log or to use them for load balancing
> rules?
>
>
>
>
> Thanks for any hints
> Regards
>
>
> Christian
>
>
>