{"library":"next-ssl-redirect-middleware","title":"Next.js SSL Redirect Middleware","description":"This package provides a simple Next.js middleware to automatically redirect HTTP requests to HTTPS, primarily useful for hosting environments like Heroku that do not offer native 'force SSL' functionality out of the box. It leverages Next.js's middleware system to intercept incoming requests and issue a 301 (or configurable) redirect when the `x-forwarded-proto` header indicates an HTTP connection. The current stable version is 0.1.5. As a focused utility, it likely has a low release cadence, receiving updates mainly for critical bug fixes or compatibility with new Next.js versions. Its key differentiator is its simplicity and direct integration into the Next.js middleware architecture, offering a lightweight solution without complex server-side configurations. It aims to solve a specific problem for specific hosting providers.","language":"javascript","status":"active","last_verified":"Thu Apr 23","install":{"commands":["npm install next-ssl-redirect-middleware"],"cli":null},"imports":["import sslRedirect from 'next-ssl-redirect-middleware';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// In middleware.ts (or .js) at the root of your Next.js project\nimport sslRedirect from 'next-ssl-redirect-middleware';\n\nexport default sslRedirect({\n  // Optional: Specify environments where the redirect should run.\n  // Defaults to ['production'].\n  environments: ['production', 'staging'],\n  // Optional: Set the HTTP status code for the redirect.\n  // Defaults to 301 (Moved Permanently).\n  status: 302 // Temporarily Moved\n});","lang":"typescript","description":"This code sets up the SSL redirect middleware to force HTTPS on 'production' and 'staging' environments with a 302 temporary redirect.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}