sub_filter (CSS,JS)

Adrian Acosta adrian at staff.netvirtue.com.au
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 {
server_name example-com-au.tempexample.com.au;
location / {
proxy_set_header Host real-domain.com;
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 "http://real-domain.com/" "
http://example-com-au.tempexample.com.au/";
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: <http://mailman.nginx.org/pipermail/nginx/attachments/20180412/8f72a638/attachment-0001.html>


More information about the nginx mailing list