# hapi-require-https

> hapi http -> https redirection

Latest version **6.0.0** (published 2022-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install hapi-require-https
pnpm add hapi-require-https
yarn add hapi-require-https
bun add hapi-require-https
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2022-11-10 |
| First published | 2014-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 14 |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | hapi, https, redirect, paas, heroku |

## Links

- npm: https://www.npmjs.com/package/hapi-require-https
- Repository: https://github.com/bendrucker/hapi-require-https
- Issues: https://github.com/bendrucker/hapi-require-https/issues
- npm.io page: https://npm.io/package/hapi-require-https

## Recent versions

- 6.0.0 (latest) — 2022-11-10
- 5.0.0 — 2020-03-02
- 4.0.0 — 2019-08-28
- 3.0.1 — 2019-02-12
- 3.0.0 — 2018-01-09
- 2.1.0 — 2017-01-19
- 2.0.10 — 2016-12-09
- 2.0.9 — 2016-08-31
- 2.0.8 — 2016-08-29
- 2.0.7 — 2016-07-31
- 2.0.6 — 2016-06-09
- 2.0.5 — 2016-02-11
- 2.0.4 — 2016-01-11
- 2.0.3 — 2015-10-21
- 2.0.2 — 2015-09-23
- … 6 more at https://npm.io/package/hapi-require-https/versions

## README

hapi-require-https [![tests](https://github.com/bendrucker/hapi-require-https/workflows/tests/badge.svg)](https://github.com/bendrucker/hapi-require-https/actions?query=workflow%3Atests)
==================

> hapi plugin that adds http to https redirection

By default, any incoming request with `'http'` in `X-Forwarded-Proto` will be redirected (301) to the same host and path with `'https'` as the protocol. You can optionally disable proxy mode and redirect based on the actual request protocol.

## Usage

Just [register the plugin](https://hapi.dev/api/#-await-serverregisterplugins-options) and go!

```js
server.register({
  plugin: require('hapi-require-https'),
  options: {}
})
```

## API

#### `plugin.register(server, [options])`

Registers the plugin to run `onRequest` in the [request lifecycle](https://hapi.dev/api/#request-lifecycle). 

##### options

Type: `object`  
Default: `{}`

###### proxy

Type: `boolean`  
Default: `true`

Indicates whether the server expects requests coming from a reverse proxy (a common Node web server setup) or directly from the Internet. Set this to `false` if you'd like to redirect based on the *actual* protocol instead of the [`X-Forwarded-Proto`](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Common_non-standard_response_fields) header.

## License

MIT © [Ben Drucker](http://bendrucker.me)

---
_Source: https://npm.io/package/hapi-require-https · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
