Problem with Substitutions NginxHttpSubsModule

Martronic SA martronic at martronic.ch
Thu Aug 12 19:59:02 MSD 2010


I'm still on the condition rule,
My code:

****************************************

upstream hoplanet {
	server xxx.xxx.xxx.xxx:8080;
	server xxx.xxx.xxx.xxx:8081;
}

server {

	if ($hhtp_kookie !~* "__ac") {
		rewrite ^/bale(.*) http://bale.hopla-net.com$1/filter/;
	}

	location = / {
		proxy_passhttp://hoplanet;
	}

	location/filter/$ {
		rewrite (.*)/fiter/$http://bale.hopla-net.com$1;
		subs_filter_types text/html text/xml;
		subs_filter 'http://www.hopla-net.com/bale''http://bale.hopla-net.com';
		proxy_passhttp://hoplanet;
	}
}

****************************************

Is that the good way to do it? or is there another way to write that 
conditional rule?

Thank you!

Martronic SA
Martial Moret

Le 11.08.2010 17:45, Martronic SA a écrit :
> I have a new question!
>
> Is it possible to disable the subsitution rules (subs_filter) under a 
> particular condition (if)
> I've tried to set those rules in a condition :
>
>  if ($http_cookie !~* "__ac") {
>     subs_filter_types text/html;
>     subs_filter tt.site.domain aa.site.domain;
> }
>
> The error is that it's not allowed to use this here.
>
> Any idea or solution?
>
> Thank you
>
> Martronic SA
> Martial Moret
>
> Le 11.08.2010 10:19, Weibin Yao a écrit :
>> Martronic SA at 2010-8-11 16:04 wrote:
>>> That's it!!! I was zipping the content in the backend!
>>> Thank you very much!
>>>
>>> Another question:
>>> Do you think it's possible to "optimize" the html code using your 
>>> product and regular expressions?
>>> Removing unnecessary backspaces and so on?
>> No, it's the job you should do when you publish your pages. Maybe you 
>> can set the gzip_filter module on. That's fine.
>>
>> My module is processing the content on the fly. It will consume a lot 
>> of resource.
>>
>> I will publish my module soon in the develop branch: 
>> http://substitutions4nginx.googlecode.com/svn/branches/dev/. It's 
>> very steady now. I have do some refactor and optimizing works in this 
>> branch, you should have try.
>>
>> Thanks.
>>>
>>> Thank you again!
>>>
>>> Le 11.08.2010 09:26, Weibin Yao a écrit :
>>>> Martronic SA at 2010-8-11 14:54 wrote:
>>>>> here is a part error.log but there was nothing particluar in it:
>>>> Hi,Martronic,
>>>>   You should activate debug log when nginx compiled with 
>>>> --with-debug configure argument.
>>>>   Do you compress the pages in the backends? or content-encoding else?
>>>>   Thanks.
>>>>>
>>>>> *********************************************
>>>>>
>>>>> 2010/08/10 18:07:16 [notice] 5917#0: *2003 "^hopla-net\.com$" does 
>>>>> not match
>>>>> "www.hopla-net.com", client: 212.74.132.20, 
>>>>> server:www.hopla-net.com, request: "GET
>>>>> /bale/sitemap.xml HTTP/1.1", host: "www.hopla-net.com:8201"
>>>>> 2010/08/10 18:07:16 [notice] 5917#0: *2003 "^/(.*)" matches 
>>>>> "/bale/sitemap.xml", client:
>>>>> 212.74.132.20, server:www.hopla-net.com, request: "GET 
>>>>> /bale/sitemap.xml HTTP/1.1", host:
>>>>> "www.hopla-net.com:8201"
>>>>> 2010/08/10 18:07:16 [notice] 5917#0: *2003 rewritten data:
>>>>> "/VirtualHostBase/http/www.hopla-net.com:80/hopla-net/VirtualHostRoot/bale/sitemap.xml", 
>>>>> args:
>>>>> "", client: 212.74.132.20, server:www.hopla-net.com, request: "GET 
>>>>> /bale/sitemap.xml
>>>>> HTTP/1.1", host: "www.hopla-net.com:8201"
>>>>>
>>>>>
>>>>> ************************************************
>>>>>
>>>>> This also:
>>>>> ************************************************
>>>>>
>>>>> 2010/08/10 16:55:28 [emerg] 20796#0: bind() to 0.0.0.0:8201 failed 
>>>>> (98: Address already in use)
>>>>> 2010/08/10 16:55:28 [emerg] 20796#0: still could not bind()
>>>>> 2010/08/10 17:01:07 [error] 20907#0: *176 open() 
>>>>> "/usr/html/w00tw00t.at.ISC.SANS.DFind:)"
>>>>> failed (2: No such file or directory), client: 127.0.0.1, server: 
>>>>> localhost, request: "GET
>>>>> /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1", host: "127.0.0.1"
>>>>> 2010/08/10 17:05:57 [alert] 20903#0: worker process 20904 exited 
>>>>> on signal 9
>>>>> 2010/08/10 17:05:57 [alert] 20903#0: worker process 20907 exited 
>>>>> on signal 9
>>>>> 2010/08/10 17:20:38 [error] 24225#0: *1468 open() 
>>>>> "/usr/html/w00tw00t.at.ISC.SANS.DFind:)"
>>>>> failed (2: No such file or directory), client: 127.0.0.1, server: 
>>>>> localhost, request: "GET
>>>>> /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1", host: "127.0.0.1"
>>>>> 2010/08/10 17:21:28 [error] 24225#0: *1577 open() 
>>>>> "/usr/html/w00tw00t.at.ISC.SANS.DFind:)"
>>>>> failed (2: No such file or directory), client: 127.0.0.1, server: 
>>>>> localhost, request: "GET
>>>>> /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1", host: "127.0.0.1"
>>>>> 2010/08/10 17:24:20 [error] 28899#0: *137 open() 
>>>>> "/usr/html/w00tw00t.at.ISC.SANS.DFind:)"
>>>>> failed (2: No such file or directory), client: 127.0.0.1, server: 
>>>>> localhost, request: "GET
>>>>> /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1", host: "127.0.0.1"
>>>>> 2010/08/10 17:38:25 [error] 28898#0: *1146 open() 
>>>>> "/usr/html/w00tw00t.at.ISC.SANS.DFind:)"
>>>>> failed (2: No such file or directory), client: 127.0.0.1, server: 
>>>>> localhost, request: "GET
>>>>> /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1", host: "127.0.0.1"
>>>>> 2010/08/10 17:48:28 [error] 4386#0: *142 open() 
>>>>> "/usr/html/w00tw00t.at.ISC.SANS.DFind:)"
>>>>> failed (2: No such file or directory), client: 127.0.0.1, server: 
>>>>> localhost, request: "GET
>>>>> /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1", host: "127.0.0.1"
>>>>> ***********************************************************
>>>>>
>>>>>
>>>>> Here is the summary with our nginx version:
>>>>>
>>>>> *************************************************
>>>>>
>>>>> /usr/sbin/nginx -V
>>>>> nginx version: nginx/0.7.67
>>>>> built by gcc 4.3.2 (Debian 4.3.2-1.1)
>>>>> TLS SNI support enabled
>>>>> configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf
>>>>> --http-log-path=/var/log/nginx/access_log 
>>>>> --error-log-path=/var/log/nginx/error_log
>>>>> --pid-path=/var/run/nginx.pid 
>>>>> --http-client-body-temp-path=/var/lib/nginx/body
>>>>> --http-proxy-temp-path=/var/tmp/nginx/proxy 
>>>>> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
>>>>> --with-md5-asm --with-md5=/usr/include --with-sha1-asm 
>>>>> --with-sha1=/usr/include
>>>>> --with-http_realip_module --with-http_ssl_module 
>>>>> --with-http_stub_status_module
>>>>> --with-http_ssl_module --with-http_flv_module 
>>>>> --with-http_gzip_static_module
>>>>> --add-module=/root/substitutions4nginx
>>>>>
>>>>> *************************************************
>>>>>
>>>>> Thank you!
>>>>>
>>>>> Martronic SA
>>>>> Martial Moret
>>>>>
>>>>>
>>>>> Le 11.08.2010 08:41, Weibin Yao a écrit :
>>>>>> Martronic SA at 2010-8-11 14:17 wrote:
>>>>>>> I m' having problems with Substitutions NginxHttpSubsModule,
>>>>>>> Everything seems to be well installed, but it doesn't substitute 
>>>>>>> anything in the html pages.
>>>>>>>
>>>>>>> Here is my config file:
>>>>>>>
>>>>>>> ********************************************
>>>>>>>  upstream hoplanet {
>>>>>>>     ip_hash;
>>>>>>>     server 94.23.227.152:9190 max_fails=6 fail_timeout=60s;
>>>>>>>     server 94.23.227.152:9191 max_fails=6 fail_timeout=60s;
>>>>>>>     server 94.23.227.152:9192 max_fails=6 fail_timeout=60s;
>>>>>>>     server 94.23.227.152:9193 max_fails=6 fail_timeout=60s;
>>>>>>>   }
>>>>>>>
>>>>>>>   server {
>>>>>>>     listen 8201;
>>>>>>>     server_name www.hopla-net.com hopla-net.com;
>>>>>>>     access_log /home/awstats/hoplanet/access.log varnish;
>>>>>>>     access_log /dev/null;
>>>>>>>
>>>>>>>     if ($host ~* ^hopla-net\.com$) {
>>>>>>>        rewrite ^(.*) http://www.hopla-net.com$1 permanent;
>>>>>>>        break;
>>>>>>>     }
>>>>>>>
>>>>>>>
>>>>>>>     rewrite ^/(.*) 
>>>>>>> /VirtualHostBase/http/www.hopla-net.com:80/hopla-net/VirtualHostRoot/$1 
>>>>>>> last;
>>>>>>>
>>>>>>>     location / {
>>>>>>>       subs_filter_types text/html text/xml;
>>>>>>>       subs_filter chantent blabla;
>>>>>>>       proxy_pass http://hoplanet;
>>>>>>>     }
>>>>>>>
>>>>>>>   }
>>>>>>> ****************************************************
>>>>>>>
>>>>>>> I've desactivated Varnish and request directly to nginx, but 
>>>>>>> 'chantent' in my pages are not substitued.
>>>>>>>
>>>>>>> I wonder if substitution doesn't work on proxied data???
>>>>>> Could you show me the debug.log? And what's your Nginx's version?
>>>>>> Thanks.
>>>>>>>
>>>>>>> Could you help me with that?
>>>>>>>
>>>>>>> Thank you very much
>>>>>>>
>>>>>>> Martronic SA
>>>>>>> Martial Moret
>>>>>>> ------------------------------------------------------------------------ 
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> nginx mailing list
>>>>>>> nginx at nginx.org
>>>>>>> http://nginx.org/mailman/listinfo/nginx
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> nginx mailing list
>>>>> nginx at nginx.org
>>>>> http://nginx.org/mailman/listinfo/nginx
>>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> nginx mailing list
>>> nginx at nginx.org
>>> http://nginx.org/mailman/listinfo/nginx
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100812/c0e67393/attachment-0001.html>


More information about the nginx mailing list