File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,10 @@ function addThrottleAndBanRules(
132132 if ( throttleAcrossAllEndpointsAllIps . maxRequestsBeforeHttp429 > 0 ) {
133133 const ruleName = `throttle-all-endpoints-all-ips-${ confEntryHead } ` ;
134134
135- // Build the expression for path and hostname matching
136- const pathExpr = `request.path.matches(' ${ endpoint . path } ' )` ;
137- const hostExpr = `request.headers['host'].matches(' ${ endpoint . hostname } ' )` ;
138- const matchExpr = `${ pathExpr } && ${ hostExpr } ` ;
135+ // Build the expression for path and hostname matching
136+ const pathExpr = `request.path.startsWith(R" ${ pathPrefix } " )` ;
137+ const hostExpr = `request.headers['host'].matches(R"^ ${ _ . escapeRegExp ( hostname ) } (:[0-9]+)?$" )` ;
138+ const matchExpr = `${ pathExpr } && ${ hostExpr } ` ;
139139
140140 new gcp . compute . SecurityPolicyRule (
141141 ruleName ,
You can’t perform that action at this time.
0 commit comments