# @valbo/redirect-to-https-middleware

> Express middleware that redirects HTTP to HTTPS

Latest version **1.0.1** (published 2021-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @valbo/redirect-to-https-middleware
pnpm add @valbo/redirect-to-https-middleware
yarn add @valbo/redirect-to-https-middleware
bun add @valbo/redirect-to-https-middleware
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-04-18 |
| First published | 2021-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Cristóbal Valverde Albo |
| Maintainers | valbo |
| Keywords | express, middleware, https |

## Links

- npm: https://www.npmjs.com/package/@valbo/redirect-to-https-middleware
- Repository: https://github.com/valverdealbo/redirect-to-https-middleware
- Issues: https://github.com/valverdealbo/redirect-to-https-middleware/issues
- npm.io page: https://npm.io/package/@valbo/redirect-to-https-middleware

## Dependencies (1)

- [@types/express](https://npm.io/package/@types/express.md) 4.x

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-04-18
- 1.0.0 — 2021-03-23

## README

# @valbo/redirect-to-https-middleware

Express middleware that redirects HTTP to HTTPS.

![npm (scoped)](https://img.shields.io/npm/v/@valbo/redirect-to-https-middleware)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
![Build Status](https://img.shields.io/github/workflow/status/valverdealbo/redirect-to-https-middleware/CI)
[![Coverage Status](https://coveralls.io/repos/github/valverdealbo/redirect-to-https-middleware/badge.svg?branch=main)](https://coveralls.io/github/valverdealbo/redirect-to-https-middleware?branch=main)
[![Known Vulnerabilities](https://snyk.io/test/github/valverdealbo/redirect-to-https-middleware/badge.svg?targetFile=package.json)](https://snyk.io/test/github/valverdealbo/redirect-to-https-middleware?targetFile=package.json)

## Install

```bash
npm install @valbo/redirect-to-https-middleware
```

## Usage

Add this middleware to your express app. To make it work behind a reverse proxy set **trust proxy** to **true**:

```typescript
import { redirectToHttpsMiddleware } from '@valbo/redirect-to-https-middleware';

app.set('trust proxy', true);
app.use(redirectToHttpsMiddleware);
```

The middleware will redirect any request with the HTTP protocol to the same URL but with the HTTPS protocol, except if the server is **localhost** or **127.0.0.1**.

---
_Source: https://npm.io/package/@valbo/redirect-to-https-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
