koajs / cors

Cross-Origin Resource Sharing(CORS) for koa
Other
732 stars 82 forks source link

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

Open ru4ert opened 2 years ago

ru4ert commented 2 years ago

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

Originally posted by @slip-box in https://github.com/koajs/cors/issues/71#issuecomment-654097447

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
})