title: Modify Request body and then proxying in Node.js
body: <p>I am a relative newbie of Node.js. It been two days that I am trying to modify the body of a Request in Node.js and then forwarding it. For proxying I am using <code>http-proxy</code> module.</p>
  
  <p>What I have to do is to intercept the password of a user inside a JSON object, encrypting it and set the new encrypted password inside the request body.</p>
  
  <p>The problem is that every time I try to collect the request body I consume it (i.e. using <code>body-parser</code>). How can I accomplish this task? I know that the Request in node is seen has a stream.</p>
  
  <p>For sake o completeness, I am using <code>express</code> to chain multiple operation before proxying.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The fact that I have to proxy the request is not useless. It follows the code that I am trying to use.</p>
  
  <pre><code>function encipher(req, res, next){
      var password = req.body.password;
      var encryptionData = Crypto().saltHashPassword(password);
      req.body.password = encryptionData.passwordHash;
      req.body['salt'] = encryptionData.salt;
      next();
  }
  
  server.post("/users", bodyParser.json(), encipher, function(req, res) {
      apiProxy.web(req, res, {target: apiUserForwardingUrl});
  });
  </code></pre>
  
  <p>The server (REST made by Spring MVC) give me the exception <code>Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: null</code></p>