
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 3,520 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.