Nginx replacing body content

Duane Mulder duanemulder at rattyshack.ca
Tue Oct 19 08:35:50 MSD 2010


Hello Weibin:

Occams Razor, thanks It turns out mod_deflate was enabled, I disabled
it  and moved the gzip options into nginx now all the cats are dogs.

Thanks very much
Duane

Weibin Yao wrote:
> Duane Mulder at 2010-10-19 6:18 wrote:
>> Hello all:
>>
>> So I have been using nginx for a while now for various types of proxying
>> and SSL acceleration all with great success. However now I  need to
>> replace specific content within an html body. I have been trying to get
>> the HttpSubsModule to work as It appears to do what I am looking for.
>> However I have not been able to get it to match or replace any content
>> whatsover. I believe I have the module compiled and loading.
>>   
> Do you compress your pages in the backends? If so, do not compress the
> content.
> Does the page's type is text/html?
>> Here is a snippit of my config, my goal would be to replace all
>> instances of  'cat' with the word dog.
>>
>> server { #server80
>>    listen  80;
>>    server_name  internal.site.com;
>>          access_log  /var/log/nginx/proxy.access.log;
>>          ##error_log /var/log/nginx/proxy.error.log debug;
>>
>>
>>
>>   location / {
>>          subs_filter_types text/html;
>>          subs_filter cat dog i;
>>
>>
>>              #proxy_set_header X-Forwarded-Host $host;
>>              #proxy_set_header X-Forwarded-Server $host;
>>              #proxy_set_header X-Forwarded-For
>> $proxy_add_x_forwarded_for;
>>              proxy_pass   http://internal.site.com:80/;
>>              #proxy_redirect off;
>>            }
>>
>> } #server80
>>
>>
>> Regards.
>> Duane
>>
>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://nginx.org/mailman/listinfo/nginx
>>
>>   
>
>




More information about the nginx mailing list