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

redirect-ssl

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redirect-ssl - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

15

index.js

@@ -8,2 +8,3 @@ const isHTTPS = require('is-https')

redirectHost: undefined,
redirectUnknown: true,
statusCode: 307

@@ -14,13 +15,15 @@ }

function create(options) {
const { xForwardedProto, redirectPort, redirectHost, statusCode } = Object.assign({}, defaults, options)
const { xForwardedProto, redirectPort, redirectHost, statusCode, redirectUnknown } = Object.assign({}, defaults, options)
const _port = redirectPort === 443 ? '' : (': ' + redirectPort)
return function redirectSSL(req, res, next) {
if (isHTTPS(req, xForwardedProto) !== false) {
return next()
const _isHttps = isHTTPS(req, xForwardedProto)
if (_isHttps === false || (redirectUnknown && _isHttps === null)) {
const ـredirectURL = 'https://' + (redirectHost || req.headers.host) + _port + req.url
res.writeHead(statusCode, { Location: ـredirectURL })
return res.end()
}
const ـredirectURL = 'https://' + (redirectHost || req.headers.host) + _port + req.url
res.writeHead(statusCode, { Location: ـredirectURL })
return res.end()
return next()
}

@@ -27,0 +30,0 @@ }

2

package.json
{
"name": "redirect-ssl",
"version": "1.0.0",
"version": "1.1.0",
"description": "Connect middleware to enforce https",

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

@@ -43,2 +43,7 @@ # redirect-ssl

### redirectUnknown
- Default: `true`
Redirect when no SSL detection method is available too. **disable** this option if you encounter **redirect loops**.
### Status Code

@@ -45,0 +50,0 @@ - Default: `307` *Temporary Redirect*

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