# koa-check-origin

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

Latest version **2.0.1** (published 2018-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-check-origin
pnpm add koa-check-origin
yarn add koa-check-origin
bun add koa-check-origin
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-10-25 |
| First published | 2018-10-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=7.6.0 |
| Dependencies | 2 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christian Rackerseder |
| Maintainers | screendriver |
| Keywords | koa, origin, middleware |

## Links

- npm: https://www.npmjs.com/package/koa-check-origin
- Repository: https://github.com/holidaycheck/koa-check-origin
- Homepage: https://github.com/holidaycheck/koa-check-origin#readme
- Issues: https://github.com/holidaycheck/koa-check-origin/issues
- npm.io page: https://npm.io/package/koa-check-origin

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) 1.9.3
- [@types/koa](https://npm.io/package/@types/koa.md) 2.0.46

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2018-10-25
- 1.0.1 — 2018-10-24
- 1.0.0 — 2018-10-24

## README

[![Build Status](https://img.shields.io/travis/holidaycheck/koa-check-origin/master.svg?style=flat)](https://travis-ci.org/holidaycheck/koa-check-origin)
[![NPM Downloads](https://img.shields.io/npm/dm/koa-check-origin.svg?style=flat)](https://www.npmjs.org/package/koa-check-origin)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier)
[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat)](https://gitmoji.carloscuesta.me)
[![made-with-typescript](https://img.shields.io/badge/Made%20with-TypeScript-1f425f.svg?style=flat)](http://www.typescriptlang.org)

# koa-check-origin

A [koa](https://koajs.com) middleware that checks if the origin matches the given base URL. If not a [HTTP 403](https://http.cat/403) is thrown.

## Installation 🏗

`koa-check-origin` requires `Node.js >= v7.6.0` because Koa [needs that](https://github.com/koajs/koa#installation) as well.

```sh
$ npm install --save koa-check-origin
```

or if you use [Yarn](https://yarnpkg.com) 🐈

```sh
$ yarn add koa-check-origin
```

## Usage 🔨

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

const app = new Koa();

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

---
_Source: https://npm.io/package/koa-check-origin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
