sub_filter (CSS,JS)

Adrian Acosta adrian at
Thu Apr 12 06:55:01 UTC 2018

Hi Everyone!

We're using nginx as a reverse proxy for a staging system so customers can
view the contents of their directories without a resolving domain.

It's working really well, but the issue is, references to their domain
aren't being filtered inside their CSS or JS files which are also loading
via the proxy URL.

*Currently the configuration of each host is as follows. *

server {
location / {
proxy_set_header Host;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
proxy_pass http://ip.ip.ip.ip/;
sub_filter_types text/html text/css text/javascript;
proxy_set_header Accept-Encoding "*";
sub_filter "" "";
sub_filter_once off;

Does anybody know if we can further configure a sub_filter so that the
contents of JS and CSS files are also filtered when loaded via the proxy?

It has been very hard finding relevant information, the docs aren't overly
helpful and even stackoverflow hasn't wielded good results.

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list