title: redirecting request to a different listener nginx
body: <p>I am having two listener 80 and 777. Port 80 act as a reverse proxy. And port 777 does some extra stuff and want to redirect to port 80. How do I redirect to a different port in nginx? I was trying with rewrite but later figured out that it is only used for change of path</p>
  
  <pre><code>   ###
     server{
              listen  80;
              server_name     _;
              location / {
                      proxy_pass "http://upstream0;#" is included since links are not allowed in the post
              }
  
      }
  
      server{
              listen  777;
              server_name     _;
              #doing some other extra stuf
              //Want to redirect to port 80 under some condition
      }
  </code></pre>
  
  <p>Is it possible?</p>
  
  <p>Thanks</p>