File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,19 @@ const app = express();
1717
1818// added trust proxy
1919const rawTrustProxy = process . env . TRUST_PROXY ;
20- const TRUST_PROXY =
21- rawTrustProxy && rawTrustProxy !== "false"
22- ? isNaN ( Number ( rawTrustProxy ) )
23- ? rawTrustProxy === "true"
24- ? true
25- : rawTrustProxy
26- : Number ( rawTrustProxy )
27- : 1 ;
20+ let TRUST_PROXY : boolean | number | string ;
21+
22+ if ( ! rawTrustProxy ) {
23+ TRUST_PROXY = 1 ;
24+ } else if ( rawTrustProxy === "false" ) {
25+ TRUST_PROXY = false ;
26+ } else if ( rawTrustProxy === "true" ) {
27+ TRUST_PROXY = true ;
28+ } else if ( ! isNaN ( Number ( rawTrustProxy ) ) ) {
29+ TRUST_PROXY = Number ( rawTrustProxy ) ;
30+ } else {
31+ TRUST_PROXY = rawTrustProxy ;
32+ }
2833
2934app . set ( "trust proxy" , TRUST_PROXY ) ;
3035
You can’t perform that action at this time.
0 commit comments