blob: fa0a53367f67391a05b7b3c0df8ee7fafa3f5622 [file] [log] [blame]
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02001 -----------------------------------------------
2 Stream Processing Offload Engine (SPOE)
3 Version 1.0
4 ( Last update: 2016-11-07 )
5 -----------------------------------------------
6 Author : Christopher Faulet
7 Contact : cfaulet at haproxy dot com
8
9
10SUMMARY
11--------
12
13 0. Terms
14 1. Introduction
15 2. SPOE configuration
16 2.1. SPOE scope
17 2.2. "spoe-agent" section
18 2.3. "spoe-message" section
19 2.4. Example
20 3. SPOP specification
21 3.1. Data types
22 3.2. Frames
23 3.2.1. Frame capabilities
24 3.2.2. Frame types overview
25 3.2.3. Workflow
26 3.2.4. Frame: HAPROXY-HELLO
27 3.2.5. Frame: AGENT-HELLO
28 3.2.6. Frame: NOTIFY
29 3.2.7. Frame: ACK
30 3.2.8. Frame: HAPROXY-DISCONNECT
31 3.2.9. Frame: AGENT-DISCONNECT
32 3.3. Events & messages
33 3.4. Actions
34 3.5. Error & timeouts
35
36
370. Terms
38---------
39
40* SPOE : Stream Processing Offload Engine.
41
42 A SPOE is a filter talking to servers managed ba a SPOA to offload the
43 stream processing. An engine is attached to a proxy. A proxy can have
44 several engine. Each engine is linked to an agent and only one.
45
46* SPOA : Stream Processing Offload Agent.
47
48 A SPOA is a service that will receive info from a SPOE to offload the
49 stream processing. An agent manages several servers. It uses a backend to
50 reference all of them. By extension, these servers can also be called
51 agents.
52
53* SPOP : Stream Processing Offload Protocol, used by SPOEs to talk to SPOA
54 servers.
55
56 This protocol is used by engines to talk to agents. It is an in-house
57 binary protocol described in this documentation.
58
59
601. Introduction
61----------------
62
63SPOE is a feature introduced in HAProxy 1.7. It makes possible the
64communication with external components to retrieve some info. The idea started
65with the problems caused by most ldap libs not working fine in event-driven
66systems (often at least the connect() is blocking). So, it is hard to properly
67implement Single Sign On solution (SSO) in HAProxy. The SPOE will ease this
68kind of processing, or we hope so.
69
70Now, the aim of SPOE is to allow any kind of offloading on the streams. First
71releases, besides being experimental, won't do lot of things. As we will see,
72there are few handled events and even less actions supported. Actually, for
73now, the SPOE can offload the processing before "tcp-request content",
74"tcp-response content", "http-request" and "http-response" rules. And it only
75supports variables definition. But, in spite of these limited features, we can
76easily imagine to implement SSO solution, ip reputation or ip geolocation
77services.
78
79
802. SPOE configuration
81----------------------
82
83Because SPOE is implemented as a filter, To use it, you must declare a "filter
84spoe" line in a proxy section (frontend/backend/listen) :
85
86 frontend my-front
87 ...
88 filter spoe [engine <name>] config <file>
89 ...
90
91The "config" parameter is mandatory. It specififies the SPOE configuration
92file. The engine name is optional. It can be set to declare the scope to use in
93the SPOE configuration. So it is possible to use the same SPOE configuration
94for several engines. If no name is provided, the SPOE configuration must not
95contain any scope directive.
96
97We use a separate configuration file on purpose. By commenting SPOE filter
98line, you completly disable the feature, including the parsing of sections
99reserved to SPOE. This is also a way to keep the HAProxy configuration clean.
100
101A SPOE configuration file must contains, at least, the SPOA configuration
102("spoe-agent" section) and SPOE messages ("spoe-message" section) attached to
103this agent. Unused messages (not reference in "spoe-agent" section) will be
104ignored.
105
106IMPORTANT : The configuration of a SPOE filter must be located in a dedicated
107file. But the backend used by a SPOA must be declared in HAProxy configuration
108file.
109
1102.1. SPOE scope
111-------------------------
112
113If you specify an engine name on the SPOE filter line, then you need to define
114scope in the SPOE configuration with the same name. You can have several SPOE
115scope in the same file. In each scope, you must define one and only one
116"spoe-agent" section to configure the SPOA linked to your SPOE and several
117"spoe-message" sections to describe messages sent to servers mananger by your
118SPOA.
119
120A SPOE scope starts with this kind of line :
121
122 [<name>]
123
124where <name> is the same engine name specified on the SPOE filter line. The
125scope ends when the file ends or when another scope is found.
126
127 Example :
128 [my-first-engine]
129 spoe-agent my-agent
130 ...
131 spoe-message msg1
132 ...
133 spoe-message msg2
134 ...
135
136 [my-second-engine]
137 ...
138
139If no engine name is provided on the SPOE filter line, no SPOE scope must be
140found in the SPOE configuration file. All the file is considered to be in the
141same anonymous and implicit scope.
142
1432.2. "spoe-agent" section
144--------------------------
145
146For each engine, you must define one and only one "spoe-agent" section. In this
147section, you will declare SPOE messages and the backend you will use. You will
148also set timeouts and options to customize your agent's behaviour.
149
150
151spoe-agent <name>
152 Create a new SPOA with the name <name>. It must have one and only one
153 "spoe-agent" definition by SPOE scope.
154
155 Arguments :
156 <name> is the name of the agent section.
157
158 following keywords are supported :
159 - messages
160 - option var-prefix
161 - timeout hello|idle|ack
162 - use-backend
163
164
165messages <msg-name> ...
166 Declare the list of SPOE messages that an agent will handle.
167
168 Arguments :
169 <msg-name> is the name of a SPOE message.
170
171 Messages declared here must be found in the same engine scope, else an error
172 is triggered during the configuration parsing. You can have many "messages"
173 lines.
174
175 See also: "spoe-message" section.
176
177
178option var-prefix <prefix>
179 Define the prefix used when variables are set by an agent.
180
181 Arguments :
182
183 <prefix> is the prefix used to limit the scope of variables set by an
184 agent.
185
186 To avoid conflict with other variables defined by HAProxy, all variables
187 names will be prefixed. By default, the "spoe-agent" name is used. This
188 option can be used to customize it.
189
190 The prefix will be added between the variable scope and its name, separated
191 by a '.'. It may only contain characters 'a-z', 'A-Z', '0-9', '.' and '_', as
192 for variables name. In HAProxy configuration, you need to use this prefix as
193 a part of the variables name. For example, if an agent define the variable
194 "myvar" in the "txn" scope, with the prefix "my_spoe_pfx", then you should
195 use "txn.my_spoe_pfx.myvar" name in your HAProxy configuration.
196
197 An agent will never set new variables at runtime. It can only set new value
198 for existing ones.
199
200
201timeout ack <timeout>
202 Set the maximum time to wait for an agent to receive the acknowledgement to a
203 NOTIFY frame.
204
205 Arguments :
206 <timeout> is the timeout value specified in milliseconds by default, but
207 can be in any other unit if the number is suffixed by the unit,
208 as explained at the top of this document.
209
210
211timeout hello <timeout>
212 Set the maximum time to wait for an agent to receive the AGENT-HELLO frame.
213
214 Arguments :
215 <timeout> is the timeout value specified in milliseconds by default, but
216 can be in any other unit if the number is suffixed by the unit,
217 as explained at the top of this document.
218
219 This timeout is an applicative timeout. It differ from "timeout connect"
220 defined on backends.
221
222
223timeout idle <timeout>
224 Set the maximum time to wait for an agent to close an idle connection.
225
226 Arguments :
227 <timeout> is the timeout value specified in milliseconds by default, but
228 can be in any other unit if the number is suffixed by the unit,
229 as explained at the top of this document.
230
231
232use-backend <backend>
233 Specify the backend to use. It must be defined.
234
235 Arguments :
236 <backend> is the name of a valid "backend" section.
237
238
2392.3. "spoe-message" section
240----------------------------
241
242To offload the stream processing, SPOE will send messages with specific
243information at a specific moment in the stream life and will wait for
244corresponding replies to know what to do.
245
246
247spoe-message <name>
248 Create a new SPOE message with the name <name>.
249
250 Arguments :
251 <name> is the name of the SPOE message.
252
253 Here you define a message that can be referenced in a "spoe-agent"
254 section. Following keywords are supported :
255 - args
256 - event
257
258 See also: "spoe-agent" section.
259
260
261args [name=]<sample> ...
262 Define arguments passed into the SPOE message.
263
264 Arguments :
265 <sample> is a sample expression.
266
267 When the message is processed, if a sample expression is not available, it is
268 set to NULL. Arguments are processed in their declaration order and added in
269 the message in that order. It is possible to declare named arguements.
270
271 For example:
272 args frontend=fe_id src dst
273
274
275event <name>
276 Set the event that triggers sending of the message.
277
278 Argument :
279 <name> is the event name.
280
281 Supported events are:
282 - on-client-session
283 - on-server-connectiob
284 - on-frontend-tcp-request
285 - on-backend-tcp-request
286 - on-tcp-response
287 - on-frontend-http-request
288 - on-backend-http-request
289 - on-http-response
290
291 See section 3.5 about Events.
292
2932.4. Example
294-------------
295
296Here is a simple but complete example that sends client-ip address to a ip
297reputation service. This service can set the variable "ip_score" which is an
298integer between 0 and 100, indicating its reputation (100 means totally safe
299and 0 a blacklisted IP with no doubt).
300
301 ###
302 ### HAProxy configuration
303 frontend www
304 mode http
305 bind *:80
306
307 filter spoe engine ip-reputation config spoe-ip-reputation.conf
308
309 # Reject connection if the IP reputation is under 20
310 tcp-request content reject if { var(sess.iprep.ip_score) -m int lt 20 }
311
312 default_backend http-servers
313
314 backend http-servers
315 mode http
316 server http A.B.C.D:80
317
318 backend iprep-servers
319 mode tcp
320 balance roundrobin
321
322 timeout connect 5s # greater than hello timeout
323 timeout server 3m # greater than idle timeout
324
325 server iprep1 A1.B1.C1.D1:12345
326 server iprep2 A2.B2.C2.D2:12345
327
328 ####
329 ### spoe-ip-reputation.conf
330 [ip-reputation]
331
332 spoe-agent iprep-agent
333 messages get-ip-reputation
334
335 option var-prefix iprep
336
337 timeout hello 2s
338 timeout ack 10ms
339 timeout idle 2m
340
341 use-backend iprep-servers
342
343 spoe-message get-ip-reputation
344 args ip=src
345 event on-client-session
346
347
3483. SPOP specification
349----------------------
350
3513.1. Data types
352----------------
353
354Here is the bytewise representation of typed data:
355
356 TYPED-DATA : <TYPE:4 bits><FLAGS:4 bits><DATA>
357
358Supported types and their representation are:
359
360 TYPE | ID | DESCRIPTION
361 -----------------------------+-----+----------------------------------
362 NULL | 0 | NULL : <0>
363 Boolean | 1 | BOOL : <1+FLAG>
364 32bits signed integer | 2 | INT32 : <2><VALUE:varint>
365 32bits unsigned integer | 3 | UINT32 : <3><VALUE:varint>
366 64bits signed integer | 4 | INT64 : <4><VALUE:varint>
367 32bits unsigned integer | 5 | UNIT64 : <5><VALUE:varint>
368 IPV4 | 6 | IPV4 : <6><STRUCT IN_ADDR:4 bytes>
369 IPV6 | 7 | IPV6 : <7><STRUCT IN_ADDR6:16 bytes>
370 String | 8 | STRING : <8><LENGTH:varint><BYTES>
371 Binary | 9 | BINARY : <9><LENGTH:varint><BYTES>
372 10 -> 15 unused/reserved | - | -
373 -----------------------------+-----+----------------------------------
374
375Variable-length integer (varint) are encoded using Peers encoding:
376
377
378 0 <= X < 240 : 1 byte (7.875 bits) [ XXXX XXXX ]
379 240 <= X < 2288 : 2 bytes (11 bits) [ 1111 XXXX ] [ 0XXX XXXX ]
380 2288 <= X < 264432 : 3 bytes (18 bits) [ 1111 XXXX ] [ 1XXX XXXX ] [ 0XXX XXXX ]
381 264432 <= X < 33818864 : 4 bytes (25 bits) [ 1111 XXXX ] [ 1XXX XXXX ]*2 [ 0XXX XXXX ]
382 33818864 <= X < 4328786160 : 5 bytes (32 bits) [ 1111 XXXX ] [ 1XXX XXXX ]*3 [ 0XXX XXXX ]
383 ...
384
385For booleans, the value (true or false) is the first bit in the FLAGS
386bitfield. if this bit is set to 0, then the boolean is evaluated as false,
387otherwise, the boolean is evaluated as true.
388
3893.2. Frames
390------------
391
392Exchange between HAProxy and agents are made using FRAME packets. All frames
393must be prefixed with their size encoded on 4 bytes in network byte order:
394
395 <FRAME-LENGTH:4 bytes> <FRAME>
396
397A frame always starts with its type, on one byte, followed by metadata
398containing flags, on 4 bytes and a two variable-length integer representing the
399stream identifier and the frame identifier inside the stream:
400
401 FRAME : <FRAME-TYPE:1 byte> <METADATA> <FRAME-PAYLOAD>
402 METADATA : <FLAGS:4 bytes> <STREAM-ID:varint> <FRAME-ID:varint>
403
404Then comes the frame payload. Depending on the frame type, the payload can be
405of three types: a simple key/value list, a list of messages or a list of
406actions.
407
408 FRAME-PAYLOAD : <LIST-OF-MESSAGES> | <LIST-OF-ACTIONS> | <KV-LIST>
409
410 LIST-OF-MESSAGES : [ <MESSAGE-NAME> <NB-ARGS:1 byte> <KV-LIST> ... ]
411 MESSAGE-NAME : <STRING>
412
413 LIST-OF-ACTIONS : [ <ACTION-TYPE:1 byte> <NB-ARGS:1 byte> <ACTION-ARGS> ... ]
414 ACTION-ARGS : [ <TYPED-DATA>... ]
415
416 KV-LIST : [ <KV-NAME> <KV-VALUE> ... ]
417 KV-NAME : <STRING>
418 KV-VALUE : <TYPED-DATA>
419
420 FLAGS : 0 1-31
421 +---+-----------+
422 | F| |
423 | I| RESERVED |
424 | N| |
425 +--+------------+
426
427 FIN: Indicates that this is the final payload fragment. The first fragment
428 may also be the final fragment.
429
430Frames cannot exceed a maximum size negociated between HAProxy and agents
431during the HELLO handshake. Most of time, payload will be small enough to send
432it in one frame. But when supported by the peer, it will be possible to
433fragment huge payload on many frames. This ability is announced during the
434HELLO handshake and it can be asynmetric (supported by agents but not by
435HAProxy or the opposite). The following rules apply to fragmentation:
436
437 * An unfragemnted payload consists of a single frame with the FIN bit set.
438
439 * A fragemented payload consists of several frames with the FIN bit clear and
440 terminated by a single frame with the FIN bit set. All these frames must
441 share the same STREAM-ID and FRAME-ID. And, of course, the FRAME-TYPE must
442 be the same.
443
444Beside the support of fragmented payload by a peer, some payload must not be
445fragmented. See below for details.
446
447IMPORTANT : The maximum size supported by peers for a frame must be greater or
448equal to 256 bytes.
449
4503.2.1. Frame capabilities
451--------------------------
452
453Here are the list of official capabilities that HAProxy and agents can support:
454
455 * fragmentation: This is the abaility for a peer to support fragmented
456 payload in received frames.
457
458Unsupported or unknown capabilities are silently ignored, when possible.
459
4603.2.2. Frame types overview
461----------------------------
462
463Here are types of frame supported by SPOE. Frames sent by HAProxy come first,
464then frames sent by agents :
465
466 TYPE | ID | DESCRIPTION
467 -----------------------------+-----+-------------------------------------
468 HAPROXY-HELLO | 1 | Sent by HAProxy when it opens a
469 | | connection on an agent.
470 | |
471 HAPROXY-DISCONNECT | 2 | Sent by HAProxy when it want to close
472 | | the connection or in reply to an
473 | | AGENT-DISCONNECT frame
474 | |
475 NOTIFY | 3 | Sent by HAProxy to pass information
476 | | to an agent
477 -----------------------------+-----+-------------------------------------
478 AGENT-HELLO | 101 | Reply to a HAPROXY-HELLO frame, when
479 | | the connection is established
480 | |
481 AGENT-DISCONNECT | 102 | Sent by an agent just before closing
482 | | the connection
483 | |
484 ACK | 103 | Sent to acknowledge a NOTIFY frame
485 -----------------------------+-----+-------------------------------------
486
487Unknown frames may be silently skipped.
488
4893.2.3. Workflow
490----------------
491
492 * Successful HELLO handshake:
493
494 HAPROXY AGENT SRV
495 | HAPROXY-HELLO |
Christopher Fauletba7bc162016-11-07 21:07:38 +0100496 | (healthcheck: false) |
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200497 | --------------------------> |
498 | |
499 | AGENT-HELLO |
500 | <-------------------------- |
501 | |
502
Christopher Fauletba7bc162016-11-07 21:07:38 +0100503 * Successful HELLO healthcheck:
504
505 HAPROXY AGENT SRV
506 | HAPROXY-HELLO |
507 | (healthcheck: true) |
508 | --------------------------> |
509 | |
510 | AGENT-HELLO + close() |
511 | <-------------------------- |
512 | |
513
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200514
515 * Error encountered by agent during the HELLO handshake:
516
517 HAPROXY AGENT SRV
518 | HAPROXY-HELLO |
519 | --------------------------> |
520 | |
521 | DISCONNECT + close() |
522 | <-------------------------- |
523 | |
524
525 * Error encountered by HAProxy during the HELLO handshake:
526
527 HAPROXY AGENT SRV
528 | HAPROXY-HELLO |
529 | --------------------------> |
530 | |
531 | AGENT-HELLO |
532 | <-------------------------- |
533 | |
534 | DISCONNECT |
535 | --------------------------> |
536 | |
537 | DISCONNECT + close() |
538 | <-------------------------- |
539 | |
540
541 * Notify / Ack exchange:
542
543 HAPROXY AGENT SRV
544 | NOTIFY |
545 | --------------------------> |
546 | |
547 | ACK |
548 | <-------------------------- |
549 | |
550
551 * Connection closed by haproxy:
552
553 HAPROXY AGENT SRV
554 | DISCONNECT |
555 | --------------------------> |
556 | |
557 | DISCONNECT + close() |
558 | <-------------------------- |
559 | |
560
561 * Connection closed by agent:
562
563 HAPROXY AGENT SRV
564 | DISCONNECT + close() |
565 | <-------------------------- |
566 | |
567
5683.2.4. Frame: HAPROXY-HELLO
569----------------------------
570
571This frame is the first one exchanged between HAProxy and an agent, when the
572connection is established. The payload of this frame is a KV-LIST. It cannot be
573fragmented. STREAM-ID and FRAME-ID are must be set 0.
574
575Following items are mandatory in the KV-LIST:
576
577 * "supported-versions" <STRING>
578
579 Last SPOP major versions supported by HAProxy. It is a comma-separated list
580 of versions, following the format "Major.Minor". Spaces must be ignored, if
581 any. When a major version is announced by HAProxy, it means it also support
582 all previous minor versions.
583
584 Example: "2.0, 1.5" means HAProxy supports SPOP 2.0 and 1.0 to 1.5
585
586 * "max-frame-size" <UINT32>
587
588 This is the maximum size allowed for a frame. The HAPROXY-HELLO frame must
589 be lower or equal to this value.
590
591 * "capabilities" <STRING>
592
593 This a comma-separated list of capabilities supported by HAProxy. Spaces
594 must be ignored, if any.
595
Christopher Fauletba7bc162016-11-07 21:07:38 +0100596Following optional items can be added in the KV-LIST:
597
598 * "healthcheck" <BOOLEAN>
599
600 If this item is set to TRUE, then the HAPROXY-HELLO frame is sent during a
601 SPOE health check. When set to FALSE, this item can be ignored.
602
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +0200603To finish the HELLO handshake, the agent must return an AGENT-HELLO frame with
604its supported SPOP version, the lower value between its maximum size allowed
605for a frame and the HAProxy one and capabilities it supports. If an error
606occurs or if an incompatibility is detected with the agent configuration, an
607AGENT-DISCONNECT frame must be returned.
608
6093.2.5. Frame: AGENT-HELLO
610--------------------------
611
612This frame is sent in reply to a HAPROXY-HELLO frame to finish a HELLO
613handshake. As for HAPROXY-HELLO frame, STREAM-ID and FRAME-ID are also set
6140. The payload of this frame is a KV-LIST and it cannot be fragmented.
615
616Following items are mandatory in the KV-LIST:
617
618 * "version" <STRING>
619
620 This is the SPOP version the agent supports. It must follow the format
621 "Major.Minor" and it must be lower or equal than one of major versions
622 announced by HAProxy.
623
624 * "max-frame-size" <UINT32>
625
626 This is the maximum size allowed for a frame. It must be lower or equal to
627 the value in the HAPROXY-HELLO frame. This value will be used for all
628 subsequent frames.
629
630 * "capabilities" <STRING>
631
632 This a comma-separated list of capabilities supported by agent. Spaces must
633 be ignored, if any.
634
635At this time, if everything is ok for HAProxy (supported version and valid
636max-frame-size value), the HELLO handshake is successfully completed. Else,
637HAProxy sends a HAPROXY-DISCONNECT frame with the corresponding error.
638
Christopher Fauletba7bc162016-11-07 21:07:38 +0100639If "healthcheck" item was set to TRUE in the HAPROXY-HELLO frame, the agent can
640safely close the connection without DISCONNECT frame. In all cases, HAProxy
641will close the connexion at the end of the health check.
642
Christopher Fauletf7e4e7e2016-10-27 22:29:49 +02006433.2.6. Frame: NOTIFY
644---------------------
645
646Information are sent to the agents inside NOTIFY frames. These frames are
647attached to a stream, so STREAM-ID and FRAME-ID must be set. The payload of
648NOTIFY frames is a LIST-OF-MESSAGES and, if supported by agents, it can be
649fragmented.
650
651NOTIFY frames must be acknowledge by agents sending an ACK frame, repeating
652right STREAM-ID and FRAME-ID.
653
6543.2.7. Frame: ACK
655------------------
656
657ACK frames must be sent by agents to reply to NOTIFY frames. STREAM-ID and
658FRAME-ID found in a NOTIFY frame must be reuse in the corresponding ACK
659frame. The payload of ACK frames is a LIST-OF-ACTIONS and, if supported by
660HAProxy, it can be fragmented.
661
6623.2.8. Frame: HAPROXY-DISCONNECT
663---------------------------------
664
665If an error occurs, at anytime, from the HAProxy side, a HAPROXY-DISCONNECT
666frame is sent with information describing the error. HAProxy will wait an
667AGENT-DISCONNECT frame in reply. All other frames will be ignored. The agent
668must then close the socket.
669
670The payload of this frame is a KV-LIST. It cannot be fragmented. STREAM-ID and
671FRAME-ID are must be set 0.
672
673Following items are mandatory in the KV-LIST:
674
675 * "status-code" <UINT32>
676
677 This is the code corresponding to the error.
678
679 * "message" <STRING>
680
681 This is a textual message describing the error.
682
683For more information about known errors, see section "Errors & timeouts"
684
6853.2.9. Frame: AGENT-DISCONNECT
686-------------------------------
687
688If an error occurs, at anytime, from the agent size, a AGENT-DISCONNECT frame
689is sent, with information desribing the error. such frame is also sent in reply
690to a HAPROXY-DISCONNECT. The agent must close the socket just after sending
691this frame.
692
693The payload of this frame is a KV-LIST. It cannot be fragmented. STREAM-ID and
694FRAME-ID are must be set 0.
695
696Following items are mandatory in the KV-LIST:
697
698 * "status-code" <UINT32>
699
700 This is the code corresponding to the error.
701
702 * "message" <STRING>
703
704 This is a textual message describing the error.
705
706For more information about known errors, see section "Errors & timeouts"
707
7083.3. Events & Messages
709-----------------------
710
711Information about streams are sent in NOTIFY frames. You can specify which kind
712of information to send by defining "spoe-message" sections in your SPOE
713configuration file. for each "spoe-message" there will be a message in a NOTIFY
714frame when the right event is triggered.
715
716A NOTIFY frame is sent for an specific event when there is at least one
717"spoe-message" attached to this event. All messages for an event will be added
718in the same NOTIFY frame.
719
720Here is the list of supported events:
721
722 * on-client-session is triggered when a new client session is created.
723 This event is only available for SPOE filters
724 declared in a frontend or a listen section.
725
726 * on-frontend-tcp-request is triggered just before the evaluation of
727 "tcp-request content" rules on the frontend side.
728 This event is only available for SPOE filters
729 declared in a frontend or a listen section.
730
731 * on-backend-tcp-request is triggered just before the evaluation of
732 "tcp-request content" rules on the backend side.
733 This event is skipped for SPOE filters declared
734 in a listen section.
735
736 * on-frontend-http-request is triggered just before the evaluation of
737 "http-request" rules on the frontend side. This
738 event is only available for SPOE filters declared
739 in a frontend or a listen section.
740
741 * on-backend-http-request is triggered just before the evaluation of
742 "http-request" rules on the backend side. This
743 event is skipped for SPOE filters declared in a
744 listen section.
745
746 * on-server-session is triggered when the session with the server is
747 established.
748
749 * on-tcp-response is triggered just before the evaluation of
750 "tcp-response content" rules.
751
752 * on-http-response is triggered just before the evaluation of
753 "http-response" rules.
754
755
756The stream processing will loop on these events, when triggered, waiting the
757agent reply.
758
7593.4. Actions
760-------------
761
762An agent must acknowledge each NOTIFY frame by sending the corresponding ACK
763frame. Actions can be added in these frames to dynamically take action on the
764processing of a stream.
765
766Here is the list of supported actions:
767
768 * set-var set the value for an existing variable. 3 arguments must be
769 attached to this action: the variable scope (proc, sess, txn,
770 req or req), the variable name (a string) and its value.
771
772 ACTION-SET-VAR : <SET-VAR:1 byte><NB-ARGS:1 byte><VAR-SCOPE:1 byte><VAR-NAME><VAR-VALUE>
773
774 SET-VAR : <1>
775 NB-ARGS : <3>
776 VAR-SCOPE : <PROCESS> | <SESSION> | <TRANSACTION> | <REQUEST> | <RESPONSE>
777 VAR-NAME : <STRING>
778 VAR-VALUE : <TYPED-DATA>
779
780 PROCESS : <0>
781 SESSION : <1>
782 TRANSACTION : <2>
783 REQUEST : <3>
784 RESERVED : <4>
785
786 * unset-var unset the value for an existing variable. 2 arguments must be
787 attached to this action: the variable scope (proc, sess, txn,
788 req or req) and the variable name (a string).
789
790 ACTION-UNSET-VAR : <SET-VAR:1 byte><NB-ARGS:1 byte><VAR-SCOPE:1 byte><VAR-NAME>
791
792 SET-VAR : <1>
793 NB-ARGS : <3>
794 VAR-SCOPE : <PROCESS> | <SESSION> | <TRANSACTION> | <REQUEST> | <RESPONSE>
795 VAR-NAME : <STRING>
796
797 PROCESS : <0>
798 SESSION : <1>
799 TRANSACTION : <2>
800 REQUEST : <3>
801 RESERVED : <4>
802
803
804NOTE: Name of the variables will be automatically prefixed by HAProxy to avoid
805 name clashes with other variables used in HAProxy. Moreover, unknown
806 variable will be silently ignored.
807
8083.5. Error & timeouts
809----------------------
810
811Here is the list of all known errors:
812
813 STATUS CODE | DESCRIPTION
814 ----------------+--------------------------------------------------------
815 0 | normal (no error occurred)
816 1 | I/O error
817 2 | A timeout occurred
818 3 | frame is too big
819 4 | invalid frame received
820 5 | version value not found
821 6 | max-frame-size value not found
822 7 | capabilities value not found
823 8 | unsupported version
824 9 | max-frame-size too big or too small
825 99 | an unknown error occurrde
826 ----------------+--------------------------------------------------------
827
828An agent can define its own errors using a not yet assigned status code.
829
830IMPORTANT NOTE: For a specific stream, when an abnormal/unexpected error
831 occurs, the SPOE is disabled for all the transaction. So if you
832 have several events configured, such error on an event will
833 disabled all followings. For TCP streams, this will disable the
834 SPOE for the whole session. For HTTP streams, this will disable
835 it for the transaction (request and response).
836
837To avoid a stream to wait infinitly, you must carefully choose the
838acknowledgement timeout. In most of cases, it will be quiet low. But it depends
839on the responsivness of your service.
840
841You must also choose idle timeout carefully. Because connection with your
842service depends on the backend configuration used by the SPOA, it is important
843to use a lower value for idle timeout than the server timeout. Else the
844connection will be closed by HAProxy. The same is true for hello timeout. You
845should choose a lower value than the connect timeout.
846
847
848/*
849 * Local variables:
850 * fill-column: 79
851 * End:
852 */