title: Nginx proxy_pass with rewrite in url?
body: <p>I would like to implement a reverse proxy which redirect request of <a href="http://www.dummy.com/foo/bar/test" rel="nofollow noreferrer">http://www.dummy.com/foo/bar/test</a> to <a href="http://127.0.0.1/hello/world" rel="nofollow noreferrer">http://127.0.0.1/hello/world</a>. I have tried to add rewrite before the pass and it seems not working ... </p>
  
  <pre><code>server {
  listen 80;
  listen [::]:80;
  
  server_name www.dummy.com;
  
  # access_log /var/log/nginx/upstream_log.log 
  
  location / {
      root   /usr/share/nginx/html/dummy;
  }
  
  location /foo/bar/test {
      rewrite  ^/foo/bar/test /hello/world break;
      proxy_pass http://127.0.0.1/;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
  
      access_log /var/log/nginx/upstream_log.log upstream_logging;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Is there something missing or wrongly configured?</p>