For some reason sub_filter
doesn't works with fastcgi_pass
which is pointing to CGI script in perl in my case.
If I try to apply sub_filter to static HTML all works fine and it swaps hrefs as expected.
Here's the config:
location /proxy/
sub_filter '<a href="http://' '<a href="//';
sub_filter_once off;
fastcgi_pass proxy:8002;
fastcgi_split_path_info ^(/proxy)(/?.*)$;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
fastcgi_buffers 256 4k;
fastcgi_intercept_errors on;
fastcgi_read_timeout 14400;
}