title: Nginx proxy: rewrite rule for root request
body: <p>I have nginx installed on port 80 and a node application on port 2368 behind nginx</p>
  
  <p>nginx configuration looks like this</p>
  
  <pre><code>server {
      server_name domain.com www.domain.com;
      listen 80; 
      location / {
          proxy_pass http://localhost:2368;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_buffering off;
      } 
  }
  </code></pre>
  
  <p>This configuration works exactly as expected. For example <code>/</code> request turns into <code>http://localhost:2368/</code>, and <code>/post/mypost</code> turns into <code>http://localhost:1234/post/mypost</code> etc.</p>
  
  <p>What I want is that only <code>/</code> request turned into <code>http://localhost:2368/latestpost/</code>. And all other requests are handled the same way as in example above. Thnx!</p>