Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 650 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 650 Bytes

expressjs-force-https

A simple express.js middleware that redirects incoming unencrypted HTTP requests to HTTPS.

Installation

npm install expressjs-force-https

Usage

const express = require("express");
const forceHTTPS = require("expressjs-force-https").forceHTTPS;
const app = express();

//Redirecting incoming unencrypted http requests
app.use(forceHTTPS);

app.listen(3000, () => {
    console.log(`Server Running...`);
});

To force HTTPS on a Node App Service on Azure:

const forceAzureHTTPS = require("expressjs-force-https").forceAzureHTTPS;

app.use(forceAzureHTTPS);