Skip to content

💣 A Koa middleware that throws a HTTP 403 when the given origin does not match.

License

Notifications You must be signed in to change notification settings

holidaycheck/koa-check-origin

Repository files navigation

Build Status NPM Downloads code style: prettier Gitmoji made-with-typescript

koa-check-origin

A koa middleware that checks if the origin matches the given base URL. If not a HTTP 403 is thrown.

Installation 🏗

koa-check-origin requires Node.js >= v7.6.0 because Koa needs that as well.

$ npm install --save koa-check-origin

or if you use Yarn 🐈

$ yarn add koa-check-origin

Usage 🔨

const createCheckOriginMiddleware = require('koa-check-origin');

const app = new Koa();

const checkOriginMiddleware = createCheckOriginMiddleware('http://example.com');
app.use(checkOriginMiddleware);

About

💣 A Koa middleware that throws a HTTP 403 when the given origin does not match.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published