Why does sub_filter seem to not work when used in conjunction with proxy_pass?
Solution 1:
Your response probably has other content-type than defined in sub_filter_types
by default.
Reference: http://nginx.org/r/sub_filter_types
Solution 2:
James T Snell answered it in a comment:
I didn't have proxy_set_header Accept-Encoding ""; you need that to tell the backend that compression isn't allowed in a response.