🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
k

koa-ssl

Enforce SSL for koa apps

2.0.1
latest
70

Supply Chain Security

100

Vulnerability

77

Quality

76

Maintenance

100

License

Unpopular package

Quality

This package is not very popular.

Found 1 instance in 1 package

Version published
Weekly downloads
373
-21.47%
Maintainers
1
Weekly downloads
 
Created
Issues
0

koa-ssl

Circle CI

koa-ssl enforces SSL for Koa apps.

Use

Simply require and use the function exported by this module:

var ssl = require('koa-ssl');
var app = require('koa')();
app.use(ssl());

The function takes an optional object of options:

  • disabled: (default false) If true, this middleware will allow all requests through.
  • trustProxy: (default false) If true, trust the x-forwarded-proto header. If it is "https", requests are allowed through.
  • disallow: A non-Generator function called with the Koa context so that the user can handle rejecting non-SSL requests themselves.

By default, this middleware will only run when process.env.NODE_ENV is set to "production". Unless a disallow function is supplied it will respond with the status code 403 and the body "Please use HTTPS when communicating with this server."

Thanks, Heroku

While I created and maintain this project, it was done while I was an employee of Heroku on the Human Interfaces Team, and they were kind enough to allow me to open source the work. Heroku is awesome.

Keywords

FAQs

Package last updated on 10 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts