https://github.com/riyadhalnur/node-force-secure-redirect
Force all incoming HTTP connections to be redirected to secure (HTTPS) version of your express app
https://github.com/riyadhalnur/node-force-secure-redirect
aws elb express-js express-middleware expressjs nodejs
Last synced: 10 months ago
JSON representation
Force all incoming HTTP connections to be redirected to secure (HTTPS) version of your express app
- Host: GitHub
- URL: https://github.com/riyadhalnur/node-force-secure-redirect
- Owner: riyadhalnur
- License: gpl-3.0
- Created: 2015-06-17T08:42:00.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-05-03T08:04:57.000Z (about 9 years ago)
- Last Synced: 2025-07-30T00:56:28.704Z (11 months ago)
- Topics: aws, elb, express-js, express-middleware, expressjs, nodejs
- Language: JavaScript
- Homepage: http://riyadhalnur.github.io/node-force-secure-redirect
- Size: 26.4 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/riyadhalnur/node-force-secure-redirect)
# node-force-secure-redirect
Force all incoming HTTP connections to be redirected to secure (HTTPS) version of your express app.
Works for node apps directly behind an Amazon ELB (Elastic Load Balancer).
## Install
`npm install node-force-secure-redirect --save`
## Usage
```js
var forceHTTPS = require('node-force-secure-redirect');
...
...
...
app.set('trust proxy'); // this is important when your app is behind an ELB
app.use(forceHTTPS('environment'));
```
where the environment *parameter* (string or array of strings) are the environment for which you want to enforce SSL on. If no environment string is passed in, HTTPS will not be enforced on any environment.
## Tests
`NODE_ENV=testing npm test`
## License
Licensed under [GPL v3](http://www.gnu.org/licenses/gpl-3.0.txt)
## Credits
Made with love in Dhaka, Bangladesh by [Riyadh Al Nur](https://twitter.com/riyadhalnur)