• Stars
    star
    193
  • Rank 196,239 (Top 4 %)
  • Language
    JavaScript
  • Created about 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Enforces SSL for Node.js ExpressJS projects

express-enforces-ssl

npm

This simple module enforces HTTPS connections on any incoming requests. In case of a non-encrypted HTTP request, express-enforces-ssl automatically redirects to an HTTPS address using a 301 permanent redirect.

express-enforces-ssl also works behind reverse proxies (load balancers) as they are for example used by Heroku and nodejitsu. In such cases, however, the trustProxy parameter has to be set (see below)

Usage

First, install the module:

$ npm install express-enforces-ssl --save

Afterwards, require the module and use the HTTPS() method:

var express = require('express');
var http = require('http');
var express_enforces_ssl = require('express-enforces-ssl');

var app = express();

app.enable('trust proxy');

app.use(express_enforces_ssl());

/*
    Routes Here
*/

http.createServer(app).listen(app.get('port'), function() {
	console.log('Express server listening on port ' + app.get('port'));
});

LICENCE

MIT

More Repositories

1

express4-bootstrap-starter

Lightweight Bootstrap NodeJS Apps Build Using ExpressJS 4, MongoDB/Mongoose, Authentication with Passport.js, Jade and GruntJS as Task Automation
JavaScript
319
star
2

blocked-sites

List of Blocked sites with the IP, so you can block the sites when user post url/link to your site
JavaScript
150
star
3

restcountries

Get information about countries via a RESTful API (Node.JS Version)
JavaScript
111
star
4

simple-server-geoip

A very simple geoip server
JavaScript
34
star
5

tia-pdc-2017

Source code Techinsia PDC 2017
JavaScript
7
star
6

mongokoo

Export and import all collections from a mongodb database into/outof a single tarball
Shell
7
star
7

terbilang

JavaScript library to convert a number to its word representation in Bahasa Indonesia language
JavaScript
6
star
8

node-parse-url

Take a URL string, and return an object. Extend from native url module
JavaScript
5
star
9

jakartajs-des-2015

Demo code for JakartaJS December 2015 Meetup - Web Scrapping With Node.js
JavaScript
4
star
10

JakartaJS-Talk

KICKSTART YOUR FRONTEND DEVELOPMENT WITH GRUNT AND BOWER
CSS
3
star
11

hulk

nothing happen but i will hulk you <eom> LOL
PHP
2
star
12

indonesia-province-geojson

2
star
13

AnguExpressjs-blog

Angular Express Simple Blog with MySQL
JavaScript
1
star
14

SublimeText-3-Personal-Setting

Python
1
star
15

buzzer

JavaScript
1
star
16

jakartajs-may-2014-meetup

JakartaJS May 2014 meetup Slides.
JavaScript
1
star
17

indonesia-provinces

List of Indonesia provinces
JavaScript
1
star
18

Ongkir

Windows 8 Apps with HTML5 and JS
1
star
19

ExpressJS-angular-starter-app

Starter ExpressJS backed app with an Angularjs as frontend.
JavaScript
1
star