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.4.1 to 2.0.0

dist/index.d.ts

29

CHANGELOG.md

@@ -1,5 +0,32 @@

# Change Log
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [2.0.0](https://github.com/nuxt-contrib/redirect-ssl/compare/v1.4.1...v2.0.0) (2020-05-31)
### ⚠ BREAKING CHANGES
* xForwardedProto renamed to trustProxy
* redirect changed to enabled and default value is always true (see example in docs)
* there might be behaviour changes for express-like frameworks
### Features
* `enabled` option ([f06e398](https://github.com/nuxt-contrib/redirect-ssl/commit/f06e3982a61bd3e6a98fdc09ab4aab85575b0e70))
* improve redirectHost type ([88cafc0](https://github.com/nuxt-contrib/redirect-ssl/commit/88cafc0fb54c6507286d5dfa9c30a5368003513b))
* rewrite to typescript ([d8460a7](https://github.com/nuxt-contrib/redirect-ssl/commit/d8460a73cd29328e055203181900bf2fa4d011b1))
* trustProxy option ([1c8cb3d](https://github.com/nuxt-contrib/redirect-ssl/commit/1c8cb3d8c769a961f96f442e922242030c0d6645))
* write redirectURL to response too ([763165b](https://github.com/nuxt-contrib/redirect-ssl/commit/763165b221a7b37957618bfe7f7f7b533790fa96))
### Bug Fixes
* fix types and redirectURL with non standard port ([e728797](https://github.com/nuxt-contrib/redirect-ssl/commit/e72879708dc4a664edd3366997f87965d6d99dfc))
### fat
* update is-https to 2.x ([d4267e7](https://github.com/nuxt-contrib/redirect-ssl/commit/d4267e76a2e176ed792a03f80b3ffebf7e39ea7e))
<a name="1.4.1"></a>

@@ -6,0 +33,0 @@ ## [1.4.1](https://github.com/nuxt-community/redirect-ssl/compare/v1.4.0...v1.4.1) (2019-08-08)

49

package.json
{
"name": "redirect-ssl",
"version": "1.4.1",
"description": "Connect middleware to enforce https",
"main": "index.js",
"repository": "git@github.com:nuxt-community/redirect-ssl.git",
"author": "Pooya Parsa <pooya@pi0.ir>",
"version": "2.0.0",
"description": "Connect/Express middleware to enforce https",
"repository": "nuxt-contrib/redirect-ssl",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"lint": "eslint . --ext js",
"test": "yarn lint",
"release": "standard-version && git push --follow-tags && npm publish"
"build": "bili src/index.ts --minimal",
"dev": "ts-node --dir test server.ts",
"lint": "eslint --ext ts .",
"typecheck": "tsc --noEmit -p . && tsc --noEmit -p ./test",
"release": "yarn build && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && yarn typecheck"
},
"dependencies": {
"is-https": "^2.0.0"
},
"devDependencies": {
"connect": "^3.7.0",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"pem": "^1.13.1",
"standard-version": "^4.4.0"
},
"dependencies": {
"is-https": "^1.0.0"
"@nuxtjs/eslint-config-typescript": "latest",
"@types/connect": "latest",
"@types/node": "latest",
"@types/pem": "latest",
"bili": "latest",
"connect": "latest",
"eslint": "latest",
"pem": "latest",
"rollup-plugin-typescript2": "latest",
"standard-version": "latest",
"ts-node": "latest",
"typescript": "latest"
}
}
# redirect-ssl
> Connect/Express middleware to enforce https using [is-https](https://www.npmjs.com/package/is-https).
[![npm](https://img.shields.io/npm/dt/redirect-ssl.svg?style=flat-square)](https://npmjs.com/package/redirect-ssl)
[![npm (scoped with tag)](https://img.shields.io/npm/v/redirect-ssl/latest.svg?style=flat-square)](https://npmjs.com/package/redirect-ssl)
[![version][npm-v-src]][npm-v-href]
[![downloads][npm-d-src]][npm-d-href]
[![ci][ci-src]][ci-href]
## Usage
Install package
Install package:
```bash
yarn add redirect-ssl # or npm install redirect-ssl
yarn add redirect-ssl
# or
npm install redirect-ssl
```
Require and use `redirect-ss`. Make sure to use this middlware as the first in your middleware chain (if using express see [middleware chain](http://expressjs.com/en/guide/using-middleware.html):
Require and use `redirect-ssl`. Make sure to use this middlware as the first in your middleware chain (if using express see [middleware chain](http://expressjs.com/en/guide/using-middleware.html):
```js
import redirectSSL from 'redirect-ssl'
// or
const redirectSSL = require('redirect-ssl')

@@ -22,29 +27,29 @@

app.use(redirectSSL)
app.use(nuxt.render) // if using nuxt
// Using custom options
app.use(redirectSSL.create({ redirectPort: 8443 }))
```
The `redirect-ssl` middleware also takes an array of options upon invocation:
### Disable for non-production or localhost
If you want to disable on `localhost`, use the exclude option:
```js
app.use(redirectSSL.create({ redirectPort: 8443 }))
app.use(redirectSSL.create({
exclude: ['localhost']
}))
```
## Usage with Nuxt
Only enable in production environments:
Add the `redirect-ssl` to the [`serverMiddleware`](https://nuxtjs.org/api/configuration-servermiddleware#usage) array within in the [nuxt.config.js](https://nuxtjs.org/api/configuration-server) file is the preferred usage:
```js
export default {
serverMiddleware: [
// Will register redirect-ssl npm package
'redirect-ssl'
]
}
app.use(redirectSSL.create({
enabled: process.env.NODE_ENV === 'production'
}))
```
You will still need to install this package within your project for it work.
## Options
### xForwardedProto
### trustProxy
- Default: `true`

@@ -54,8 +59,8 @@

### redirect
- Default: `process.env.NODE_ENV === 'production'`
### enabled
Only enabled in production environment. Force redirecting locally by setting this option to `true`.
- Default: `true`
### redirectPort
- Default: `443`

@@ -66,4 +71,5 @@

### redirectHost
- Default: `undefined`
- Default: `req.headers.host`
Redirects using this value as host, if omitted will use request host for redirects.

@@ -74,2 +80,3 @@

### redirectUnknown
- Default: `true`

@@ -80,2 +87,3 @@

### statusCode
- Default: `307` *Temporary Redirect*

@@ -89,2 +97,3 @@

### exclude
- Default: `[]`

@@ -94,3 +103,32 @@

## Using with [Nuxt.js](https://github.com/nuxt/nuxt.js)
Add the `redirect-ssl` to the [`serverMiddleware`](https://nuxtjs.org/api/configuration-servermiddleware#usage) array within in the [nuxt.config.js](https://nuxtjs.org/api/configuration-server) file is the preferred usage:
```js
import redirectSSL from 'redirectSSL'
export default {
serverMiddleware: [
redirectSSL.create({
enabled: process.env.NODE_ENV === 'production'
}),
]
}
```
You will still need to install this package within your project for it work.
## License
MIT - [Nuxt.js](https://nuxtjs.org)
MIT. Made with 💖
<!-- Refs -->
[npm-v-src]: https://img.shields.io/npm/v/redirect-ssl?style=flat-square
[npm-v-href]: https://npmjs.com/package/redirect-ssl
[npm-d-src]: https://img.shields.io/npm/dm/redirect-ssl?style=flat-square
[npm-d-href]: https://npmjs.com/package/redirect-ssl
[ci-src]: https://img.shields.io/github/workflow/status/nuxt-contrib/redirect-ssl/ci/master?style=flat-square
[ci-href]: https://github.com/nuxt-contrib/redirect-ssl/actions?query=workflow%3Aci
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