title: Dynamic routing with NGINX
body: <p>I am an amateur of NGINX, I want to setup NGINX as a Reverse Proxy for my web server.
  I would like to know that the NGINX these things as listed below:</p>
  
  <p>When a browser send request with URL: <a href="http://nginxproxy.com/client/1.2.3.4/" rel="nofollow">http://nginxproxy.com/client/1.2.3.4/</a>, this request should be passed to the client with IP 1.2.3.4 <a href="http://1.2.3.4/" rel="nofollow">http://1.2.3.4/</a>, the browser should still show the URL nginxproxy/client/1.2.3.4/
  And the same for: </p>
  
  <ul>
  <li>nginxproxy.com/client/2.3.4.5 --> //2.3.4.5</li>
  <li>nginxproxy.com/client/2.3.4.6 --> //2.3.4.6</li>
  </ul>
  
  <p>All the others requests that doesn't mach the pattern should come to my default server myserver.</p>
  
  <p>Can I do this by using NGINX?</p>
  
  <p>After researching, I tried with the below configuration:
  But unlucky, It doesn't work. The address was changed to http:/1.2.3.4 on browser's address bar, instead of http:/nginxproxy.com/client/1.2.3.4 as expected.</p>
  
  <pre><code>server {
      listen       80;
  
      location ~ ^/client {       
          rewrite ^/client/?(.*) /$2 break;
          proxy_pass $scheme://$1;             
      }
      location / {
          proxy_pass http://myserver.com;
      }
  }
  </code></pre>
  
  <p>Any help is much appreciated.</p>