The Filter directive runs an external command and then pipes the data through the external command before processing that data in the proxy by using the pre-filter function.
Syntax
Filter fn="pre-filter" path="/your/filter/prog"
The Filter directive performs these tasks:
Runs the program /your/filter/prog as a separate process.
Establishes pipes between the proxy and the external program.
Writes the response data from the remote server to the stdin of the external program.
Reads the stdout of the program as if it were the response generated by the server.
This process is equivalent to this command:
Filter fn="pre-filter" path="/your/filter/prog" headers="stdin"
The following Filter functions are described in detail in this section:
Applicable in Filter-class directives.
filter-ct can be used to block response content that matches a certain MIME type.
The following table describes the parameter for the filter-ct function.
Table 5–132 filter-ct Parameters
Parameter |
Description |
---|---|
regexp |
Regular expression of the mime type to be filtered. |
Filter fn="filter-ct" regexp="(application/octet-stream)" |
Applicable in Filter-class directives.
filter-html can be used to filter out HTML tags from the response content before sending it to the client.
The following table describes parameters for the filter-html function.
Table 5–133 filter-html Parameters
Parameter |
Description |
---|---|
start |
HTML start tag |
end |
HTML end tag |
Filter fn="filter-html" start="APPLET" end="APPLET" |
Applicable in Filter-class directives.
pre-filter is used to run external filter programs before returning response content to the client.
The following table describes the parameter for the pre-filter function.
Table 5–134 pre-filter Parameters
Parameter |
Description |
---|---|
path |
absolute path to external filter program. |
Filter fn="pre-filter" path="/your/filter/prog"