mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-31 05:57:33 +00:00
add express-sslify types (#36482)
This commit is contained in:
parent
e59b55d75c
commit
3fee2364df
18
types/express-sslify/express-sslify-tests.ts
Normal file
18
types/express-sslify/express-sslify-tests.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Application } from 'express';
|
||||
import { HTTPS } from 'express-sslify';
|
||||
|
||||
declare const express: Application;
|
||||
declare const booleanFlag: boolean;
|
||||
|
||||
express.use(HTTPS());
|
||||
express.use(HTTPS({}));
|
||||
express.use(HTTPS({ trustAzureHeader: booleanFlag }));
|
||||
express.use(HTTPS({ trustProtoHeader: booleanFlag }));
|
||||
express.use(HTTPS({ trustXForwardedHostHeader: booleanFlag }));
|
||||
express.use(
|
||||
HTTPS({
|
||||
trustXForwardedHostHeader: booleanFlag,
|
||||
trustAzureHeader: booleanFlag,
|
||||
trustProtoHeader: booleanFlag,
|
||||
})
|
||||
);
|
||||
32
types/express-sslify/index.d.ts
vendored
Normal file
32
types/express-sslify/index.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
// Type definitions for express-sslify 1.2
|
||||
// Project: https://github.com/florianheinemann/express-sslify
|
||||
// Definitions by: Ben Grynhaus <https://github.com/bengry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { RequestHandler } from 'express';
|
||||
|
||||
export interface Options {
|
||||
/**
|
||||
* Heroku, nodejitsu and other hosters often use reverse proxies which offer SSL endpoints but then forward unencrypted HTTP traffic to the website.
|
||||
* This makes it difficult to detect if the original request was indeed via HTTPS.
|
||||
* Luckily, most reverse proxies set the x-forwarded-proto header flag with the original request scheme.
|
||||
* @default false
|
||||
*/
|
||||
trustProtoHeader?: boolean;
|
||||
|
||||
/**
|
||||
* Azure has a slightly different way of signaling encrypted connections.
|
||||
* To tell express-sslify to look out for Azure's x-arr-ssl header.
|
||||
* @default false
|
||||
*/
|
||||
trustAzureHeader?: boolean;
|
||||
|
||||
/**
|
||||
* If your reverse proxy sends the original host using the X-Forwarded-Host header and you need to use that instead of the Host header for the redirect.
|
||||
* @default false
|
||||
*/
|
||||
trustXForwardedHostHeader?: boolean;
|
||||
}
|
||||
|
||||
export function HTTPS(options?: Options): RequestHandler;
|
||||
23
types/express-sslify/tsconfig.json
Normal file
23
types/express-sslify/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express-sslify-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/express-sslify/tslint.json
Normal file
1
types/express-sslify/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user