title: Nginx - redirect to a new url based on the Payload
body: <p>I have a scenario in my project where the incoming request will be http:///MailService.aspx with a XML Payload. I have to interpret the payload and look for a tag mail. Based on the value of the tag, proxy_pass the url to  http:///signin or http:///mail</p>
  <p>Sample Payload:</p>
  <pre><code>&lt;Request&gt;
  &lt;CommandType&gt;send&lt;/CommandType&gt;
  &lt;From&gt;test@abc.com&lt;/From&gt;
  &lt;To&gt;test@new.com&lt;/To&gt;
  &lt;/Request&gt;
  </code></pre>
  <p>Incoming URI: http:///MailServices.aspx</p>
  <p>Nginx Conf:</p>
  <pre><code>location /MailServices.aspx {
          proxy_pass http://&lt;domain&gt;/mail;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header X-Forwarded-Port $server_port;
      }
  </code></pre>
  <p>Am looking for a solution like below within nginx conf,</p>
  <p>if(commandType is 'mail') uri = http:///mail
  if(commandType is 'signin') uri = http:///signin</p>