Module. It scans the output chains buffer and matches string line by line, just like Apache's mod_substitute (<http://httpd.apache.org/docs/trunk/mod/mod_substitute.html>). Example location / { subs_filter_types text/html text/css text/xml; subs_filter st(\d*).example.com $1....