sub_filter via proxy with gzip

Steve Wilson lists-nginx at swsystem.co.uk
Sat May 12 01:58:10 UTC 2012


Hey,

For various reasons which I won't go into, I'm trying to rewrite content
via a proxy using a sub_filter, this is fine as long as I use
proxy_set_header Accept-Encoding "";
to disable gzip to the upstream proxy.

here's the relevant part with domains/mods changed:

    location / {
        proxy_set_header Accept-Encoding "";
        proxy_pass  http://upstream.site/;
        sub_filter_types text/css;
        sub_filter_once off;
        sub_filter .upstream.site special.our.domain;
    }

basically "upstream.site" has content served from static.upstream.site
which we rewrite without issue as long as Accept-Encoding is empty.
Due to bandwidth constraints I could do with getting gzip or even
deflate working with the upstream.

How can this be done?

Steve.



More information about the nginx mailing list