http-subs-filter #

Streaming response substitution — search-and-replace text or regex patterns inside response bodies on the fly, without buffering the whole document.

Source: upstream source

Directives

subs_buffers #

syntax: subs_buffers 2 args (number and size of buffers);  ·  context: http, server, location

Number and size of buffers, e.g. "32 4k".

subs_filter #

syntax: subs_filter 2+ args;  ·  context: http, server, location

You can disable the compressed response like this: proxy_set_header Accept-Encoding ""; subs_filter syntax: subs_filter source_str destination_str [gior] default: none context: http, server, location subs_filter allows replacing source string(regular expression or fixed) in the nginx response with destination string.

subs_filter_bypass #

syntax: subs_filter_bypass 1+ args;  ·  context: http, server, location

Disables the substitutions filter for the current request when any listed variable is non-empty and not equal to zero.

subs_filter_types #

syntax: subs_filter_types 1+ args;  ·  context: http, server, location

Adds MIME content types, beyond text/html, that the substitutions filter should process.

subs_line_buffer_size #

syntax: subs_line_buffer_size 2 args (size (k/m/g));  ·  context: http, server, location

Size in bytes; accepts k / m / g suffixes.

Example

    set $foo "0";
    set $bypass "1";
    location / {
        subs_filter 'taobao.com' 'yaoweibin' ir;
        subs_filter_bypass $foo $bypass;
        proxy_pass http://yaoweibin.net:8080/test/subs/taobao.htm;
    }

↑ back to index