express-force-https-schema
Version:
configurable express middleware that forces https schema based on x-forwarded-proto header
44 lines (30 loc) • 847 B
Markdown
on x-forwarded-proto header.
The x-forwarded-proto is used by Heroku, AWS ELB and others to tell which schema the request was made with.
```javascript
import forceHttpsSchema from "express-force-https-schema";
const app = express();
app.use(
forceHttpsSchema({
enabled: process.env.FORCE_HTTPS === "true",
skipUserAgents: /ELB-HealthChecker/i
})
);
```
| Key | Default |
| --------------- | ----------------- |
| enabled | true |
| userAgentHeader | user-agent |
| schemaHeader | x-forwarded-proto |
| skipUserAgents | null |
```
npm test
```
```
$ npm install express-force-https-schema
```
Very simple configurable express middleware that forces https schema based