--- title: "9. Supported Filters" linkTitle: "9. Filters" weight: 200 description: "Trace, compression, SPOE, cache, FastCGI, OpenTracing, and bandwidth filters" icon: fa-solid fa-layer-group module: [HAPROXY] categories: [Reference] aliases: - /haproxy/configuration/filters/ - /docs/haproxy/configuration/filters/ - /haproxy/filters/ upstream_link: "https://docs.haproxy.org/3.4/configuration.html" upstream_name: "HAProxy 3.4 Configuration Manual" upstream_ref: "v3.4.4, chapter 9" --- Here are listed officially supported filters with the list of parameters they accept. Depending on compile options, some of these filters might be unavailable. The list of available filters is reported in haproxy -vv. See also: "filter" ## 9.1. Trace {#section-9-1} filter trace [name ``] [random-forwarding] [max-fwd ``] [hexdump] Arguments: ```text is an arbitrary name that will be reported in messages. If no name is provided, "TRACE" is used. inhibits trace messages. enables the random forwarding of parsed data. By default, this filter forwards all previously parsed data. With this parameter, it only forwards a random amount of the parsed data. is the maximum amount of data that can be forwarded at a time. "max-fwd" option can be combined with the random forwarding. must be an positive integer. 0 means there is no limit. dumps all forwarded data to the server and the client. ``` This filter can be used as a base to develop new filters. It defines all callbacks and print a message on the standard error stream (stderr) with useful information for all of them. It may be useful to debug the activity of other filters or, quite simply, HAProxy's activity. Using `` and/or `` parameters is a good way to tests the behavior of a filter that parses data exchanged between a client and a server by adding some latencies in the processing. ## 9.2. HTTP compression {#section-9-2} filter comp-req Enables filter that explicitly tries to compress HTTP requests according to "compression" settings. Implicitly sets "compression direction request". filter comp-res Enables filter that explicitly tries to compress HTTP responses according to "compression" settings. Implicitly sets "compression direction response" filter compression (deprecated) Alias for backward compatibility purposes that is functionally equivalent to enabling both "comp-req" and "comp-res" filter. "compression" keyword must be used to configure appropriate behavior: The HTTP compression has been moved in a filter in HAProxy 1.7. "compression" keyword must still be used to enable and configure the HTTP compression. And when no other filter is used, it is enough. When used with the cache or the fcgi-app enabled, it is also enough. In this case, the compression is always done after the response is stored in the cache. But it is mandatory to explicitly use a filter line to enable the HTTP compression when at least one filter other than the cache or the fcgi-app is used for the same listener/frontend/backend. This is important to know the filters evaluation order. See also: "compression", [section 9.4](/docs/haproxy/filters/#section-9-4) about the cache filter and [section 9.5](/docs/haproxy/filters/#section-9-5) about the fcgi-app filter. ## 9.3. Stream Processing Offload Engine (SPOE) {#section-9-3} filter spoe [engine ``] config `` Arguments: ```text is the engine name that will be used to find the right scope in the configuration file. If not provided, all the file will be parsed. is the path of the engine configuration file. This file can contain configuration of several engines. In this case, each part must be placed in its own scope. ``` The Stream Processing Offload Engine (SPOE) is a filter communicating with external components. It allows the offload of some specifics processing on the streams in tiered applications. These external components and information exchanged with them are configured in dedicated files, for the main part. It also requires dedicated backends, defined in HAProxy configuration. SPOE communicates with external components using an in-house binary protocol, the Stream Processing Offload Protocol (SPOP). When the SPOE is used on a stream, a dedicated stream is spawned to handle the communication with the external component. The main stream is the parent stream of this "SPOE" stream. It means it is possible to retrieve variables of the main stream from the "SPOE" stream. See [section 2.8](/docs/haproxy/configuration-basics/#section-2-8) about variables for details. For all information about the SPOE configuration and the SPOP specification, see "doc/SPOE.txt". ## 9.4. Cache {#section-9-4} filter cache `` Arguments: ```text is name of the cache section this filter will use. ``` The cache uses a filter to store cacheable responses. The HTTP rules "cache-store" and "cache-use" must be used to define how and when to use a cache. By default the corresponding filter is implicitly defined. And when no other filters than fcgi-app or compression are used, it is enough. In such case, the compression filter is always evaluated after the cache filter. But it is mandatory to explicitly use a filter line to use a cache when at least one filter other than the compression or the fcgi-app is used for the same listener/frontend/backend. This is important to know the filters evaluation order. See also: [section 9.2](/docs/haproxy/filters/#section-9-2) about the compression filter, [section 9.5](/docs/haproxy/filters/#section-9-5) about the fcgi-app filter and [section 6](/docs/haproxy/cache/) about cache. ## 9.5. Fcgi-app {#section-9-5} filter fcgi-app `` Arguments: ```text is name of the fcgi-app section this filter will use. ``` The FastCGI application uses a filter to evaluate all custom parameters on the request path, and to process the headers on the response path. the `` must reference an existing fcgi-app section. The directive "use-fcgi-app" should be used to define the application to use. By default the corresponding filter is implicitly defined. And when no other filters than cache or compression are used, it is enough. But it is mandatory to explicitly use a filter line to a fcgi-app when at least one filter other than the compression or the cache is used for the same backend. This is important to know the filters evaluation order. See also: "use-fcgi-app", [section 9.2](/docs/haproxy/filters/#section-9-2) about the compression filter, [section 9.4](/docs/haproxy/filters/#section-9-4) about the cache filter and [section 10](/docs/haproxy/fastcgi/) about FastCGI application. ## 9.6. OpenTracing {#section-9-6} The OpenTracing filter adds native support for using distributed tracing in HAProxy. This is enabled by sending an OpenTracing compliant request to one of the supported tracers such as Datadog, Jaeger, Lightstep and Zipkin tracers. Please note: tracers are not listed by any preference, but alphabetically. This feature is only enabled when HAProxy was built with USE_OT=1. The OpenTracing filter activation is done explicitly by specifying it in the HAProxy configuration. If this is not done, the OpenTracing filter in no way participates in the work of HAProxy. filter opentracing [id ``] config `` Arguments: ```text is the OpenTracing filter id that will be used to find the right scope in the configuration file. If no filter id is specified, 'ot-filter' is used as default. If scope is not specified in the configuration file, it applies to all defined OpenTracing filters. is the path of the OpenTracing configuration file. The same file can contain configurations for multiple OpenTracing filters simultaneously. In that case we do not need to define scope so the same configuration applies to all filters or each filter must have its own scope defined. ``` More detailed documentation related to the operation, configuration and use of the filter can be found in the addons/ot directory. Note: The OpenTracing filter shouldn't be used for new designs as OpenTracing itself is no longer maintained nor supported by its authors. As such OpenTracing will be deprecated in 3.3 and removed in 3.5. A replacement filter based on OpenTelemetry is available since 3.4 with complete build instructions currently at: ```text https://github.com/haproxytech/haproxy-opentelemetry/ ``` ## 9.7. Bandwidth limitation {#section-9-7} filter bwlim-in `` default-limit `` default-period `