<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">
<div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br>Igor,<br><br>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? <br><br>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?<br><br>Thanks,<br>-M<br><br>ps, I doubt it matters, but I have CentOS 5.2 64 bit.<br><br><br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr
 size="1"><b><span style="font-weight: bold;">From:</span></b> Igor Sysoev &lt;is@rambler-co.ru&gt;<br><b><span style="font-weight: bold;">To:</span></b> nginx@sysoev.ru<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, January 28, 2009 12:04:35 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: question about addition filter<br></font><br>
On Wed, Jan 28, 2009 at 11:21:35AM -0800, Mohammad Kolahdouzan wrote:<br><br>&gt; Is it possible to have a configuration similar to the following:<br>&gt; <br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  location /x {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  proxy_pass <a rel="nofollow" target="_blank" href="http://www.yahoo.com;">http://www.yahoo.com;</a><br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  }<br>&gt; <br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  location /y {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add_before_body /x;<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add_after_body&nbsp; <a rel="nofollow" target="_blank" href="http://www.google.com;">http://www.google.com;</a><br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  }<br>&gt; <br>&gt; which would supposedly add the content of the <a rel="nofollow" target="_blank" href="http://www.yahoo.com">www.yahoo.com</a> and <a rel="nofollow" target="_blank" href="http://www.google.com">www.google.com</a> 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!<br><br>This should work, but it's better to use 0.7.32 for this:<br><br>&nbsp; &nbsp; &nbsp; &nbsp;  location = /x {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  proxy_pass <a rel="nofollow" target="_blank" href="http://www.yahoo.com/;">http://www.yahoo.com/;</a><br>&nbsp; &nbsp; &nbsp; &nbsp;  }<br><br>&nbsp; &nbsp; &nbsp; &nbsp;  location = /g{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  proxy_pass&nbsp; <a rel="nofollow" target="_blank" href="http://www.google.com/;">http://www.google.com/;</a><br>&nbsp; &nbsp; &nbsp; &nbsp;  }<br><br>&nbsp; &nbsp; &nbsp; &nbsp;  location /y {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add_before_body /x;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add_after_body&nbsp; /q;<br>&nbsp; &nbsp; &nbsp; &nbsp;  }<br><br><br>-- <br>Igor Sysoev<br><a rel="nofollow" target="_blank"
 href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br><br></div></div></div></div><br>

      </body></html>