Proxy_pass and sub_filter?


#1

Hi, I have a special use case to employ sub_filter to alter the content
from an upstream server by proxy_pass. Here is my minimal nginx.conf:

#############

user www-data www-data;

worker_processes 4;

events
{
use epoll;
worker_connections 2048;
}

http
{
include “mime.types”;
server
{
server_name external.upei.ca;

            listen 80;

            sub_filter internal.upei.ca external.upei.ca;
            sub_filter_types text/xml text/css text/javascript;

            location /
            {
                    proxy_pass http://internal.upei.ca;
            }
    }

}

#########

But the substitution filter does not work in this configuration. I tried
fastcgi_pass before and sub_filter works with fastcgi_pass. I also
googled around and found no answer to this question. Is this
configuration correct for sub_filter the content from a proxy upstream
server? Thank you!


#2

I figured out that my backend server is configured with gzip module.
When I disable the gzip module, it works perfectly.