redirect-ssl is a Connect/Express middleware designed to enforce HTTPS for web applications, ensuring all incoming HTTP requests are redirected to their HTTPS equivalent. It leverages the `is-https` package for robust HTTPS detection, including support for `x-forwarded-proto` headers often found when deployed behind proxies. The current stable version is 3.0.0, which introduced significant changes like a TypeScript rewrite and renaming of key configuration options. While no strict release cadence is stated, major versions appear to introduce breaking changes, signaling active development and modernization. Its key differentiators include flexible configuration for proxy trust, custom redirect ports/hosts, and exclusion patterns, making it adaptable for various deployment scenarios including Nuxt.js applications. It aims to provide a reliable and configurable solution for ensuring secure communication by default.
npm install redirect-sslVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage with Express, enabling HTTPS redirection only in production environments and configuring a custom HTTPS port for redirection, while excluding localhost.
Update your configuration to use `trustProxy` instead of `xForwardedProto`. The default value is `true`.
Replace `redirect: false` with `enabled: false`. If you relied on a default of `false`, you now explicitly need to set `enabled: false`.
Thoroughly test your application's redirect behavior after upgrading. Pay close attention to how `redirect-ssl` interacts with other middleware, especially those affecting request headers or response status codes.
Ensure `app.use(redirectSSL)` or `app.use(redirectSSL.create(...))` is called before any other routes or middleware that you intend to secure with HTTPS.
If you experience redirect loops, try setting `redirectUnknown: false` in your options. Additionally, verify your proxy/load balancer is correctly setting `x-forwarded-proto` headers if `trustProxy` is `true`.
Ensure you are using `redirect-ssl` within an Express or Connect application, for example: `import express from 'express'; const app = express(); app.use(redirectSSL);`
Set `redirectUnknown: false` in `redirectSSL.create()` options. If behind a proxy, ensure `trustProxy: true` is set and the proxy correctly forwards `x-forwarded-proto`.
No dependency data recorded yet.