npm.io
1.0.2 • Published 5 years ago

@kittgen/nestjs-https-redirect

Licence
MIT
Version
1.0.2
Deps
4
Size
14 kB
Vulns
3
Weekly
0
Stars
46

Kittgen Nestjs HTTPS redirect middleware

HTTPS redirect middleware for Nestjs.

Check the main page for Kittgen for further information.

Usage

Installation

npm i @kittgen/nestjs-https-redirect
Register your middleware
Add Middleware to ApplicationModule

Further explanations about middlewares can be found in the Nestjs documentation.

export class ApplicationModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(HttpsRedirectMiddleware({ enabled: true })).forRoutes({
      path: '*',
      method: RequestMethod.ALL,
    });
  }
}
Reverse Proxys

If you're behind a reverse proxy (e.g. Heroku or nginx) make sure to enable trust proxy for your express app:

app.enable('trust proxy');

Local Development

Local Library Development
Important Commands
# start in watcher mode
npm start

# builds to the 'dist' folder
npm run build

# runs the tests
npm test
Commits

We use conventional commits for nice commit messages and automated versioning/changelog.

This packages uses TSDX.

License

Kittgen is licensed under MIT. See LICENSE.

Authors

Kittgen is developed by Otto von Wesendonk and Edgar Müller.

Keywords