Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jclem/express-ssl
Enforce SSL for Express apps
https://github.com/jclem/express-ssl
Last synced: about 1 month ago
JSON representation
Enforce SSL for Express apps
- Host: GitHub
- URL: https://github.com/jclem/express-ssl
- Owner: jclem
- Created: 2014-04-07T18:35:46.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-19T18:05:44.000Z (almost 10 years ago)
- Last Synced: 2024-09-13T04:03:15.278Z (2 months ago)
- Language: JavaScript
- Homepage: https://npmjs.org/package/express-ssl
- Size: 191 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# express-ssl
express-ssl enforces SSL for Express apps.
## Use
Simply require and use the function exported by this module:
```javascript
var ssl = require('express-ssl');
var app = require('express')();
app.use(ssl());
```The function requires 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 function called with the request and response 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][heroku] on the Human Interfaces Team, and they were kind enough to
allow me to open source the work. Heroku is awesome.[heroku]: https://www.heroku.com/home