question about addition filter

Mohammad Kolahdouzan mohammad_ysm at yahoo.com
Thu Jan 29 00:28:50 MSK 2009


Igor,

I tried your config, with 0.7.32 and 0.7.31, with/without debug, with/without optimization, but I constantly get garbage before and after the content of /y/index.html. Maybe it is returning some uninitialized memory? 

I might be totally wrong, but Evan's module development tutorial mentions something about NGX_AGAIN and that we should return NGX_AGAIN if ngx_http_subrequest returns NGX_AGAIN. But looking in to your code, ngx_http_addition_filter_module.c, line numbers 154 and 183, you are always returning NGX_ERROR if ngx_http_subrequest does not return NGX_OK. Could that be the reason?

Thanks,
-M

ps, I doubt it matters, but I have CentOS 5.2 64 bit.





________________________________
From: Igor Sysoev <is at rambler-co.ru>
To: nginx at sysoev.ru
Sent: Wednesday, January 28, 2009 12:04:35 PM
Subject: Re: question about addition filter

On Wed, Jan 28, 2009 at 11:21:35AM -0800, Mohammad Kolahdouzan wrote:

> Is it possible to have a configuration similar to the following:
> 
>         location /x {
>             proxy_pass http://www.yahoo.com;
>         }
> 
>         location /y {
>             add_before_body /x;
>             add_after_body  http://www.google.com;
>         }
> 
> which would supposedly add the content of the www.yahoo.com and www.google.com before and after the content of the page at /y/index.html? The addition filter module states that the texts after add_before_body and add_after_body are URI, but the above config doesn't seem to be doing it!

This should work, but it's better to use 0.7.32 for this:

         location = /x {
             proxy_pass http://www.yahoo.com/;
         }

         location = /g{
             proxy_pass  http://www.google.com/;
         }

         location /y {
             add_before_body /x;
             add_after_body  /q;
         }


-- 
Igor Sysoev
http://sysoev.ru/en/


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090128/d5ff3c60/attachment.html>


More information about the nginx mailing list