New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-enforces-ssl

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-enforces-ssl - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

34

index.js

@@ -0,27 +1,23 @@

'use strict';
(function(module) {
'use strict';
module.exports = function enforceHTTPS() {
module.exports = function enforceHTTPS() {
return function(req, res, next) {
return function(req, res, next) {
var isHttps = req.secure;
var isHttps = req.secure;
if(isHttps){
next();
} else {
redirectUrl(req);
}
}
};
var redirectUrl = function (req, res) {
if(req.method === "GET") {
res.redirect(301, "https://" + req.headers.host + req.originalUrl);
if(isHttps){
next();
} else {
res.send(403, "Please use HTTPS when submitting data to this server.");
redirectUrl(req, res);
}
}
};
})(module);
var redirectUrl = function (req, res) {
if(req.method === "GET") {
res.redirect(301, "https://" + req.headers.host + req.originalUrl);
} else {
res.send(403, "Please use HTTPS when submitting data to this server.");
}
}
{
"name": "express-enforces-ssl",
"version": "1.0.0",
"version": "1.1.0",
"description": "Enforces SSL for node.js express projects",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc