Parameter based redirect in nginx
<p>I have http requests such as the one below being sent to an nginx server:</p>

<pre><code>GET /app/handler?id=1234&amp;param1=cbd&amp;param2=234
</code></pre>

<p>Now, I want to rewrite the request to a different handler depending on the id param in the request. eg. redirect to handler_even for even ids and handler_odd for odd ids. This is shown below:</p>

<pre><code>GET /app/handler?id=1234&amp;param1=cbd&amp;param2=234 =&gt; /app/handler_even?id=1234&amp;param1=cbd&amp;param2=234
GET /app/handler?id=123&amp;param1=cbd&amp;param2=234 =&gt; /app/handler_odd?id=123&amp;param1=cbd&amp;param2=234
</code></pre>

<p>I can do the rewrite using proxy_pass, but I'm unsure how to redirect using the id parameter value. Any idea how I could go about this? Would using "if" be the best way to go about this?</p>

<p>Any pointers would be useful </p>