Skip to content

Redirecting HTTP to HTTPS. It forces SSL (HTTPS) when HTTP is required using Express (Nodejs) and remove www and trailing slash on your domain.

License

Notifications You must be signed in to change notification settings

brunomacedo/ssl-express-www

Repository files navigation

Force SSL using Express (Redirect HTTP to HTTPS)

Redirecting HTTP to HTTPS. It forces SSL (HTTPS) when HTTP is required using Express (Nodejs) and remove www and trailing slash on your domain.

project-version downloads npm mocha Build Status

Installation

npm install ssl-express-www

Usage CommonJS

var express = require('express');
var secure = require('ssl-express-www');
var app = express();

app.use(secure);

var port = process.env.PORT || 3000;
app.listen(port, () => console.log('Server listening.'));

Usage ES6

Transpile it with Babel

import express from 'express';
import secure from 'ssl-express-www';

const app = express();

app.use(secure);

let port = process.env.PORT || 3000;
app.listen(port, () => console.log('Server listening.'));

License

This project is licensed under the MIT License - see the LICENSE file for details