title: KoaJS ctx.redirect() causing ERR_TOO_MANY_REDIRECTS in Chrome
body: <p>I'm new to KoaJS. Playing a bit now. I'm trying to redirect all request to a particular URL using a middle-ware. This seems to product <code>ERR_TOO_MANY_REDIRECTS</code> in Chrome. I tried a lot to debug. Can't get what is wrong.</p>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>// App
  const Koa = require('koa')
  const app = new Koa()
  
  // Parser
  const bodyParser = require('koa-body')
  app.use(bodyParser())
  
  // Session
  const session = require('koa-session')
  app.keys = ['asdfasdf@#$ASDf1#$@5rasdf']
  app.use(session(app))
  // THIS MIDDLEWARE
  app.use(async (ctx, next) =&gt; {
      ctx.session.user = '121' // This is all playground. No production stuff.
      const s = ctx.session.user
      if (s != '1213') {
          ctx.redirect('/login')
      }
      await next()
  })
  
  // Router
  const common = require('./routes')
  app.use(common.routes())
  
  // Server
  app.listen(3000, () =&gt; { console.log('Listening on http://localhost:3000') })
  </code></pre>
  
  <p><strong>routes.js</strong></p>
  
  <pre><code>const Router = require('koa-router')
  const router = new Router()
  
  // const User = require('./user')
  
  router.get('/', async ctx =&gt; {
      ctx.body = 'Home Page'
  })
  
  router.get('/login', async ctx =&gt; {
      ctx.body = 'Login Page'
  })
  
  module.exports = router
  </code></pre>