title: Replicate Nginx proxy_pass on NodeJs + Express
body: <p>If you do this in Nginx:</p>
  
  <pre><code>location /apiproxy/ {
      proxy_pass                      https://apidev.site.com/;
  }
  </code></pre>
  
  <p>All request to domain.com/apiproxy/* will be passed to apidev.site.com/*, so domain.com/apiproxy/foo/bar/ will be passed to apidev.site.com/foo/bar.</p>
  
  <p>Im trying to replicate the same behavior in NodeJS with express and <a href="https://www.npmjs.com/package/express-http-proxy" rel="nofollow noreferrer">proxy</a>, according to documentation:</p>
  
  <pre><code>app.use('/apiproxy/*', proxy('https://apidev.site.com/v1', {
      proxyReqPathResolver: function(req) {
          console.log(require('url').parse(req.url).path);
          return require('url').parse(req.url).path;
      }}));
  </code></pre>
  
  <p>But that loose everithing after /apriproxy/. Any idea?</p>