title: Browsersync middleware: Redirect from a post request
body: <p>We are using browsersync in development. For a payment confirmation, the payment provider posts back to a predefined url.</p>
  
  <p>The problem is, that Browsersync only displays <code>Cannot POST /payment/success</code>.</p>
  
  <p>So I was thinking about writing a middleware that takes the POST request and redirects to the same URL as a GET request. The problem is, I'm not sure if this is possible with browser sync. When I try to call <code>res.redirect('/')</code> it throws an error:</p>
  
  <pre><code>    browserSync.init
          server:
              baseDir: "...."
              index: "/statics/master.html"
              middleware: [
                  modRewrite(['!\\.\\w+$ /statics/master.html [L]']),
                  (req, res, next) -&gt;
                      res.redirect('/') # this throws a TypeError: res.redirect is not a function
              ]
  </code></pre>
  
  <blockquote>
    <ol>
    <li>Why is <code>res.redirect</code> not defined? I thought browser sync is based on express?</li>
    <li>How could I access the body of the post request? <code>req.body</code> returns <code>undefined</code></li>
    </ol>
  </blockquote>