]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: spoe: Set the parent stream for SPOE streams
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 17 Jul 2024 15:06:00 +0000 (17:06 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 18 Jul 2024 15:06:12 +0000 (17:06 +0200)
commit127083a7a28ea5bfb6c74658111f90c9650cb09b
tree02b488dbed12e11c0c62317e9067b1bdf79d6fce
parent230c1570ac43989b8851142dceb0a3ffed1458cc
MEDIUM: spoe: Set the parent stream for SPOE streams

When a SPOE applet is created to send a message to an agent, the parent of
the associated stream is set to the one filtered. And the relationship
between the streams is removed when the applet is released or when the
processing on main stream is finished.

In the mean time, it is possible to get variables of the parent stream from
the SPOE one. It is not a huge change but this will be amazingly useful. For
instance, it is now possible to be sticky on a server using a critera of the
main streem. Here is an example using the client source address:

  listen http
    bind *:80
    tcp-request content set-var(txn.client_src) src
    filter spoe engine {SPOE-NAME} config /{SPOE-CONFIG}
    http-request send-spoe-group {SPOE-NAME} {SPOE-MSG}
    server www 127.0.0.1:8000

  backend spoe-backend
    mode spop
    timeout server 10s

    stick-table type ip size 200k expire 30m
    stick on var(ptxn.client_src)

    server srv1 ...
    server srv2 ...
    server srv3 ...
    server srv4 ...

Of course, the feature is not limited to stick-tables. Everywhere variables
are used, it is now possible to get the value set on the parent stream from
the SPOE stream.
src/flt_spoe.c