File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ class App {
2929 constructor ( routes : Routes [ ] ) {
3030 this . app = express ( )
3131 this . port = config . port
32+ /*
33+ 'trust proxy' must be set to 2 when deployed behind GCP load-balancing in order to correctly identify
34+ the requestor's IP address rather than that of the load-balancer. This is required for per-user rate-limiting.
35+ See also - https://cloud.google.com/load-balancing/docs/https#x-forwarded-for_header
36+ */
37+ this . app . set ( 'trust proxy' , 2 )
3238
3339 this . initializeMiddlewares ( )
3440 this . initializeRoutes ( routes )
@@ -125,12 +131,6 @@ class App {
125131 genid : generateSessionId ,
126132 } )
127133 )
128- /*
129- 'trust proxy' must be set to 2 when deployed behind GCP load-balancing in order to correctly identify
130- the requestor's IP address rather than that of the load-balancer. This is required for per-user rate-limiting.
131- See also - https://cloud.google.com/load-balancing/docs/https#x-forwarded-for_header
132- */
133- this . app . set ( 'trust proxy' , 2 )
134134 this . app . use ( passport . initialize ( ) )
135135 this . app . use ( passport . session ( ) )
136136
You can’t perform that action at this time.
0 commit comments