http_sub_module / sub_filter nginx 和反向代理不工作

http_sub_module / sub_filter of nginx and reverse proxy not working

我正在尝试反向代理我的网站并修改内容。 为此,我使用 sub_filter 编译了 nginx。 它现在接受 sub_filter 指令,但不知何故不起作用。

server {
    listen       8080;
    server_name  www.xxx.com;

    access_log  /var/log/nginx/www.goparts.access.log  main;
    error_log  /var/log/nginx/www.goparts.error.log;
    root   /usr/share/nginx/html;
    index  index.html index.htm;

    ## send request back to apache1 ##
    location / {
       sub_filter <title> '<title>test</title>';
 sub_filter_once on;


     proxy_pass  http://www.google.fr;
     proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
     proxy_redirect off;
     proxy_buffering off;
     proxy_set_header        Host            $host;
     proxy_set_header        X-Real-IP       $remote_addr;
     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

   }
}

请帮帮我

检查上游源码是否开启了gzip,如果是则需要

proxy_set_header Accept-Encoding "";

所以整个事情会像

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;
}

检查这些链接