koajs / cors

Cross-Origin Resource Sharing(CORS) for koa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

https://github.com/koajs/cors/blob/master/index.js#L138

ru4ert opened this issue · comments

I got it :https://github.com/koajs/cors/blob/master/index.js#L138

Originally posted by @slip-box in #71 (comment)

allowHeaders don't proxy custom headers [1] to koa middleware. [2]

[1]

  server.applyMiddleware({
      app,
      cors: {
        allowHeaders: ['authorization'],
      },
    })

[2]

export const app = new Koa()
 app.use(async (ctx, next) => {
    ctx.req.headers.authorization // this is undefined
})