I read some modules out there and could manage to write a custom module that will do the job. I have some doubts though.<br>How can I call the original upstream module from my own upstream module? I don&#39;t want to replace it.<br>
<br>I think the magic might go here:<br>ngx_http_upstream_init_&lt;module name&gt;_peer method. Is that right? Is there any example that I can use?<br><br>Thanks!<br><br>Jonathan<br><br><div class="gmail_quote">On Mon, May 9, 2011 at 1:42 PM, Jonathan Leibiusky <span dir="ltr">&lt;<a href="mailto:ionathan@gmail.com">ionathan@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi!<br>Nginx is great and the way it handles upstream and failed server as well! I would just like to avoid retrying request when they are POSTs, as POSTs are no idempotent and my backend can&#39;t handle duplicated POSTs right now.<br>

So I started to mess around with the code. What I have in mind is to create a module that will change the behavior of proxy_next_upstream by just checking that http method != POST.<br>I believe it supposed to be really simple.<br>

So a couple of questions for those who are into nginx source code:<br>1. Is there any good article, blog post, etc, that explain how to create and test a module?<br>2. Any good advice on how I should do it? I was thinking on adding the validation somewhere in ngx_http_upstream_test_next (ngx_http_upstream.c), something like:<br>

if (r-&gt;method == NGX_HTTP_POST) {<br>  return NGX_DECLINED;<br>}<br><br>If this is OK, how could I do this from a module? So when someone compiles nginx with this module, he&#39;ll have this behavior instead of the standard one?<br>

<br>Sorry if my questions are dumb.<br><font color="#888888"><br>Jonathan<br>
</font></blockquote></div><br>