Why does sub_filter seem to not work when used in conjunction with proxy_pass?

Posted by kylehayes on Server Fault See other posts from Server Fault or by kylehayes
Published on 2013-10-18T17:25:58Z Indexed on 2013/10/18 21:58 UTC
Read the original article Hit count: 197

Filed under:
|

Given the following configuration of nginx:

server {
    listen  80;
    server_name apilocal;
    sub_filter  "apiupstream/api" "apilocal";
    sub_filter_once off;
    location /people/ {
            proxy_pass  http://apiupstream/api/people/;
            proxy_set_header Accept-Encoding "";
    }
}

Sub_filter does not properly response parts of the response. Once I remove proxy_pass from the configuration, it works properly. A lot of folks with this problem end up having gzip compression from the upstream server. I've verified that my upstream server does not have gzip encoding turned on for its responses. But just in case, I've also used the proxy_set_header above to not accept gzip.

Is there potentially something else I'm missing?

© Server Fault or respective owner

Related posts about nginx

Related posts about proxy