nginx_substitutions_filter is a filter module which can do both regular
expression and fixed string substitutions on response bodies. This
quite different from the Nginx’s Substitution Module. It scans the
chains buffer and matches string line by line, just like Apache’s
To install, compile nginx with the following option:
subs_filter_types syntax: subs_filter_types mime-type [mime-type ...] default: subs_filter_types text/html context: http, server, location description: subs_filter_types is used to specify which content
be checked for subs_filter. The default is only text/html.
subs_filter syntax: subs_filter source_str destination_str [gior] default: none context: http, server, location description: subs_filter allows replacing source stringe(regular
or fixed) in the nginx response with destination string.
text may contain variables. More than one substitution rules per
location is supported.
The meaning of the third flags are:
g(default): Replace all the match strings.
i: Perform a case-insensitive match.
o: Just replace the first one.
r: The pattern is treated as a regular expression, default
Questions/patches may be directed to Weibin Y., email@example.com.