<HTML><BODY>&nbsp;&nbsp;&nbsp; location ~ /items.* {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $ok 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($query_string !~ .*&amp;ids=.*) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $ok 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($request_method != GET) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set $ok 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( $ok = 1 ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass <a href="http://mail.ru;"><a href="http://mail.ru;">http://mail.ru;</a></a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( $ok = 0 ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass <a href="http://google.ru;"><a href="http://google.ru;">http://google.ru;</a></a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br><br><br>Thu, 7 Apr 2011 20:50:15 -0300 письмо от Jonathan Leibiusky &lt;ionathan@gmail.com&gt;:<br><br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;" class="mailru-blockquote"><div id="class_1302253262">so there is no way to do what I am trying to do?<br>I see I could make rewrites. the problem with that is that it won't be transparent to the application underneath.<br>I know there is a lua module. maybe there is a way to do it with lua?<br>
<br>as I said, I just need to be able to match on headers and uri and decide to which upstream to pass the request.<br><br><div class="gmail_quote">On Thu, Apr 7, 2011 at 8:42 PM, Ivan <span dir="ltr">&lt;<a target="_blank" href="sentmsg?compose&amp;To=bdfy@mail.ru">bdfy@mail.ru</a>&gt;</span> wrote:<br>
<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
<div>nginx doesn't have a rich programming language :). if - it is only a new localtion :).<br><br>see this example:<br><br><a target="_blank" href="http://markmail.org/message/yv6x3z66x3a5jdv2"></a><a target="_blank" href="http://markmail.org/message/yv6x3z66x3a5jdv2"></a><a target="_blank" href="http://markmail.org/message/yv6x3z66x3a5jdv2"></a><a href="http://markmail.org/message/yv6x3z66x3a5jdv2"><a href="http://markmail.org/message/yv6x3z66x3a5jdv2">http://markmail.org/message/yv6x3z66x3a5jdv2</a></a><br>
<br>&nbsp;<br>Thu, 7 Apr 2011 19:33:25 -0300 письмо от Jonathan Leibiusky &lt;<a target="_blank" href="sentmsg?compose&amp;To=ionathan@gmail.com">ionathan@gmail.com</a>&gt;:<br><br><blockquote style="border-left: 1px solid rgb(8, 87, 166); margin: 10px; padding: 0pt 0pt 0pt 10px;">
<div><div><div></div><div class="h5">hi! first I wanted to say that nginx is a great product!<br>I am trying to use it to route my traffic with several different rules. This way I can do ab testing.<br>My rules use different inputs, like http headers and uri of the request.<br>

I am using right now the location block with regex. But when I need to do something more complex (like matching the query string and http_method) I can't find a way to do it as it seems like nginx doesn't have a rich programming language, which is reasonable. But I am sure there are ways to do what I want, like:<br>

<br>location ~ /items.* {<br>&nbsp; if ($query_string ~ .*&amp;ids=.* &amp;&amp; $request_method = GET) {<br>&nbsp;&nbsp;&nbsp; proxy_pass pool_a;<br>&nbsp; }<br>&nbsp; proxy_pass pool_b;<br>}<br><br>this is just an example, my rules can get more complex. what would be the recommended way to address this?<br>

<br>thanks!<br><br>jonathan<br></div></div>

_______________________________________________<br>
nginx mailing list<br>
<a target="_blank" href="http://sentmsg?compose&amp;To=nginx@nginx.org">nginx@nginx.org</a><br>
<a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a href="http://nginx.org/mailman/listinfo/nginx"><a href="http://nginx.org/mailman/listinfo/nginx">http://nginx.org/mailman/listinfo/nginx</a></a><br>

<br>
</div></blockquote><br></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a target="_blank" href="sentmsg?compose&amp;To=nginx@nginx.org">nginx@nginx.org</a><br>
<a target="_blank" href="http://nginx.org/mailman/listinfo/nginx"></a><a href="http://nginx.org/mailman/listinfo/nginx"><a href="http://nginx.org/mailman/listinfo/nginx">http://nginx.org/mailman/listinfo/nginx</a></a><br>
<br></blockquote></div><br>

</div></blockquote><br></BODY></HTML>