cors
cors copied to clipboard
Cross-Origin Resource Sharing(CORS) for koa
## Checklist cannot set Access-Control-Allow-Origin to *, when Access-Control-Allow-Credentials is true - [x] I have ensured my pull request is not behind the main or master branch of the original...
## Motivation The current syntax is not friendly to scenarios where the global `Promise` object may have been re-mapped to a different class, _and_ async functions are being used. Example:...
Closes #73
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]** ``` typescript server.applyMiddleware({ app, cors: { allowHeaders: ['authorization'], },...
After merge this PR we can close all the issues and PRs.
I use koa-socket-2. 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
this my config ```js app.use(convert(require('koa-static')(__dirname + '/public'))) app.use(cors({ origin: function (ctx) { return '*'; }, exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'], maxAge: 5, credentials: true, allowMethods: ['GET', 'POST', 'DELETE'], allowHeaders: ['Content-Type', 'Authorization', 'Accept'],...
added command for yarn "yarn add @koa/cors"
I tried ```javascript app.use(cors({ origin: function (ctx) { if (['https://www.example1.com', 'https://www.example2.com'].includes(ctx.get('Origin'))) { return ctx.get('Origin'); } return null; } })); ``` But it doesn't work, any solution ?
Hi I want this project doesn't require additional typing library(which is @types/koa__cors) when coding in TypeScript. This could be solved by adding `.d.ts` file. Any ideas?