Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
express-http-to-https
Advanced tools
express-http-to-https is a node.js package for providing an Express middleware that redirects the client to HTTPS if they attempt to connect over HTTP.
express-http-to-https
express-http-to-https is a node.js package for providing an Express middleware that redirects the client to HTTPS if they attempt to connect over HTTP.
$ npm install --save express-http-to-https
app.use(redirectToHTTPS(ignoreHosts, ignoreRoutes);
[/localhost:8080/]
.var express = require('express');
var app = express();
var redirectToHTTPS = require('express-http-to-https').redirectToHTTPS
// Don't redirect if the hostname is `localhost:port` or the route is `/insecure`
app.use(redirectToHTTPS([/localhost:(\d{4})/], [/\/insecure/], 301));
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.get('/insecure', function (req, res) {
res.send('Dangerous!');
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
app.listen(8080, function () {
console.log('Example app listening on port 8080 insecurely!');
});
MIT License
Max Walker (max@maxwalker.me)
Aleksander Szmigiel
FAQs
express-http-to-https is a node.js package for providing an Express middleware that redirects the client to HTTPS if they attempt to connect over HTTP.
The npm package express-http-to-https receives a total of 1,923 weekly downloads. As such, express-http-to-https popularity was classified as popular.
We found that express-http-to-https demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.