blob: 538bb26847fb9749c5bab50212c29223445bf56d [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 |
496 | --------------------------> |
497 | |
498 | AGENT-HELLO |
499 | <-------------------------- |
500 | |
501
502
503 * Error encountered by agent during the HELLO handshake:
504
505 HAPROXY AGENT SRV
506 | HAPROXY-HELLO |
507 | --------------------------> |
508 | |
509 | DISCONNECT + close() |
510 | <-------------------------- |
511 | |
512
513 * Error encountered by HAProxy during the HELLO handshake:
514
515 HAPROXY AGENT SRV
516 | HAPROXY-HELLO |
517 | --------------------------> |
518 | |
519 | AGENT-HELLO |
520 | <-------------------------- |
521 | |
522 | DISCONNECT |
523 | --------------------------> |
524 | |
525 | DISCONNECT + close() |
526 | <-------------------------- |
527 | |
528
529 * Notify / Ack exchange:
530
531 HAPROXY AGENT SRV
532 | NOTIFY |
533 | --------------------------> |
534 | |
535 | ACK |
536 | <-------------------------- |
537 | |
538
539 * Connection closed by haproxy:
540
541 HAPROXY AGENT SRV
542 | DISCONNECT |
543 | --------------------------> |
544 | |
545 | DISCONNECT + close() |
546 | <-------------------------- |
547 | |
548
549 * Connection closed by agent:
550
551 HAPROXY AGENT SRV
552 | DISCONNECT + close() |
553 | <-------------------------- |
554 | |
555
5563.2.4. Frame: HAPROXY-HELLO
557----------------------------
558
559This frame is the first one exchanged between HAProxy and an agent, when the
560connection is established. The payload of this frame is a KV-LIST. It cannot be
561fragmented. STREAM-ID and FRAME-ID are must be set 0.
562
563Following items are mandatory in the KV-LIST:
564
565 * "supported-versions" <STRING>
566
567 Last SPOP major versions supported by HAProxy. It is a comma-separated list
568 of versions, following the format "Major.Minor". Spaces must be ignored, if
569 any. When a major version is announced by HAProxy, it means it also support
570 all previous minor versions.
571
572 Example: "2.0, 1.5" means HAProxy supports SPOP 2.0 and 1.0 to 1.5
573
574 * "max-frame-size" <UINT32>
575
576 This is the maximum size allowed for a frame. The HAPROXY-HELLO frame must
577 be lower or equal to this value.
578
579 * "capabilities" <STRING>
580
581 This a comma-separated list of capabilities supported by HAProxy. Spaces
582 must be ignored, if any.
583
584To finish the HELLO handshake, the agent must return an AGENT-HELLO frame with
585its supported SPOP version, the lower value between its maximum size allowed
586for a frame and the HAProxy one and capabilities it supports. If an error
587occurs or if an incompatibility is detected with the agent configuration, an
588AGENT-DISCONNECT frame must be returned.
589
5903.2.5. Frame: AGENT-HELLO
591--------------------------
592
593This frame is sent in reply to a HAPROXY-HELLO frame to finish a HELLO
594handshake. As for HAPROXY-HELLO frame, STREAM-ID and FRAME-ID are also set
5950. The payload of this frame is a KV-LIST and it cannot be fragmented.
596
597Following items are mandatory in the KV-LIST:
598
599 * "version" <STRING>
600
601 This is the SPOP version the agent supports. It must follow the format
602 "Major.Minor" and it must be lower or equal than one of major versions
603 announced by HAProxy.
604
605 * "max-frame-size" <UINT32>
606
607 This is the maximum size allowed for a frame. It must be lower or equal to
608 the value in the HAPROXY-HELLO frame. This value will be used for all
609 subsequent frames.
610
611 * "capabilities" <STRING>
612
613 This a comma-separated list of capabilities supported by agent. Spaces must
614 be ignored, if any.
615
616At this time, if everything is ok for HAProxy (supported version and valid
617max-frame-size value), the HELLO handshake is successfully completed. Else,
618HAProxy sends a HAPROXY-DISCONNECT frame with the corresponding error.
619
6203.2.6. Frame: NOTIFY
621---------------------
622
623Information are sent to the agents inside NOTIFY frames. These frames are
624attached to a stream, so STREAM-ID and FRAME-ID must be set. The payload of
625NOTIFY frames is a LIST-OF-MESSAGES and, if supported by agents, it can be
626fragmented.
627
628NOTIFY frames must be acknowledge by agents sending an ACK frame, repeating
629right STREAM-ID and FRAME-ID.
630
6313.2.7. Frame: ACK
632------------------
633
634ACK frames must be sent by agents to reply to NOTIFY frames. STREAM-ID and
635FRAME-ID found in a NOTIFY frame must be reuse in the corresponding ACK
636frame. The payload of ACK frames is a LIST-OF-ACTIONS and, if supported by
637HAProxy, it can be fragmented.
638
6393.2.8. Frame: HAPROXY-DISCONNECT
640---------------------------------
641
642If an error occurs, at anytime, from the HAProxy side, a HAPROXY-DISCONNECT
643frame is sent with information describing the error. HAProxy will wait an
644AGENT-DISCONNECT frame in reply. All other frames will be ignored. The agent
645must then close the socket.
646
647The payload of this frame is a KV-LIST. It cannot be fragmented. STREAM-ID and
648FRAME-ID are must be set 0.
649
650Following items are mandatory in the KV-LIST:
651
652 * "status-code" <UINT32>
653
654 This is the code corresponding to the error.
655
656 * "message" <STRING>
657
658 This is a textual message describing the error.
659
660For more information about known errors, see section "Errors & timeouts"
661
6623.2.9. Frame: AGENT-DISCONNECT
663-------------------------------
664
665If an error occurs, at anytime, from the agent size, a AGENT-DISCONNECT frame
666is sent, with information desribing the error. such frame is also sent in reply
667to a HAPROXY-DISCONNECT. The agent must close the socket just after sending
668this frame.
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.3. Events & Messages
686-----------------------
687
688Information about streams are sent in NOTIFY frames. You can specify which kind
689of information to send by defining "spoe-message" sections in your SPOE
690configuration file. for each "spoe-message" there will be a message in a NOTIFY
691frame when the right event is triggered.
692
693A NOTIFY frame is sent for an specific event when there is at least one
694"spoe-message" attached to this event. All messages for an event will be added
695in the same NOTIFY frame.
696
697Here is the list of supported events:
698
699 * on-client-session is triggered when a new client session is created.
700 This event is only available for SPOE filters
701 declared in a frontend or a listen section.
702
703 * on-frontend-tcp-request is triggered just before the evaluation of
704 "tcp-request content" rules on the frontend side.
705 This event is only available for SPOE filters
706 declared in a frontend or a listen section.
707
708 * on-backend-tcp-request is triggered just before the evaluation of
709 "tcp-request content" rules on the backend side.
710 This event is skipped for SPOE filters declared
711 in a listen section.
712
713 * on-frontend-http-request is triggered just before the evaluation of
714 "http-request" rules on the frontend side. This
715 event is only available for SPOE filters declared
716 in a frontend or a listen section.
717
718 * on-backend-http-request is triggered just before the evaluation of
719 "http-request" rules on the backend side. This
720 event is skipped for SPOE filters declared in a
721 listen section.
722
723 * on-server-session is triggered when the session with the server is
724 established.
725
726 * on-tcp-response is triggered just before the evaluation of
727 "tcp-response content" rules.
728
729 * on-http-response is triggered just before the evaluation of
730 "http-response" rules.
731
732
733The stream processing will loop on these events, when triggered, waiting the
734agent reply.
735
7363.4. Actions
737-------------
738
739An agent must acknowledge each NOTIFY frame by sending the corresponding ACK
740frame. Actions can be added in these frames to dynamically take action on the
741processing of a stream.
742
743Here is the list of supported actions:
744
745 * set-var set the value for an existing variable. 3 arguments must be
746 attached to this action: the variable scope (proc, sess, txn,
747 req or req), the variable name (a string) and its value.
748
749 ACTION-SET-VAR : <SET-VAR:1 byte><NB-ARGS:1 byte><VAR-SCOPE:1 byte><VAR-NAME><VAR-VALUE>
750
751 SET-VAR : <1>
752 NB-ARGS : <3>
753 VAR-SCOPE : <PROCESS> | <SESSION> | <TRANSACTION> | <REQUEST> | <RESPONSE>
754 VAR-NAME : <STRING>
755 VAR-VALUE : <TYPED-DATA>
756
757 PROCESS : <0>
758 SESSION : <1>
759 TRANSACTION : <2>
760 REQUEST : <3>
761 RESERVED : <4>
762
763 * unset-var unset the value for an existing variable. 2 arguments must be
764 attached to this action: the variable scope (proc, sess, txn,
765 req or req) and the variable name (a string).
766
767 ACTION-UNSET-VAR : <SET-VAR:1 byte><NB-ARGS:1 byte><VAR-SCOPE:1 byte><VAR-NAME>
768
769 SET-VAR : <1>
770 NB-ARGS : <3>
771 VAR-SCOPE : <PROCESS> | <SESSION> | <TRANSACTION> | <REQUEST> | <RESPONSE>
772 VAR-NAME : <STRING>
773
774 PROCESS : <0>
775 SESSION : <1>
776 TRANSACTION : <2>
777 REQUEST : <3>
778 RESERVED : <4>
779
780
781NOTE: Name of the variables will be automatically prefixed by HAProxy to avoid
782 name clashes with other variables used in HAProxy. Moreover, unknown
783 variable will be silently ignored.
784
7853.5. Error & timeouts
786----------------------
787
788Here is the list of all known errors:
789
790 STATUS CODE | DESCRIPTION
791 ----------------+--------------------------------------------------------
792 0 | normal (no error occurred)
793 1 | I/O error
794 2 | A timeout occurred
795 3 | frame is too big
796 4 | invalid frame received
797 5 | version value not found
798 6 | max-frame-size value not found
799 7 | capabilities value not found
800 8 | unsupported version
801 9 | max-frame-size too big or too small
802 99 | an unknown error occurrde
803 ----------------+--------------------------------------------------------
804
805An agent can define its own errors using a not yet assigned status code.
806
807IMPORTANT NOTE: For a specific stream, when an abnormal/unexpected error
808 occurs, the SPOE is disabled for all the transaction. So if you
809 have several events configured, such error on an event will
810 disabled all followings. For TCP streams, this will disable the
811 SPOE for the whole session. For HTTP streams, this will disable
812 it for the transaction (request and response).
813
814To avoid a stream to wait infinitly, you must carefully choose the
815acknowledgement timeout. In most of cases, it will be quiet low. But it depends
816on the responsivness of your service.
817
818You must also choose idle timeout carefully. Because connection with your
819service depends on the backend configuration used by the SPOA, it is important
820to use a lower value for idle timeout than the server timeout. Else the
821connection will be closed by HAProxy. The same is true for hello timeout. You
822should choose a lower value than the connect timeout.
823
824
825/*
826 * Local variables:
827 * fill-column: 79
828 * End:
829 */