Commit 8e2b2da
committed
BUG/MINOR: fix ReplacePrefixMatch path rewrite edge cases
When ReplacePrefixMatch is "/" and matchPrefix is a non-root prefix (e.g.
"/strip-prefix"), the single replace-path rule produced an empty path for
requests that match the prefix exactly (no suffix), because the optional
capture group \1 evaluates to "". Two replace-path rules are now emitted:
one anchored to the exact prefix that hard-sets "/" and one for the suffix
case.
When ReplacePrefixMatch is "/" and matchPrefix is also "/", the rewrite is
a no-op for every path. The set-path rule that was previously emitted used
regsub(^/$,) which stripped the root path to an empty string, causing a 400.
The rule is now skipped entirely. The same empty-path bug existed in
requestRedirectRules and is fixed there as well.1 parent ac412d9 commit 8e2b2da
2 files changed
Lines changed: 79 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
285 | 289 | | |
286 | 290 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
292 | 315 | | |
293 | 316 | | |
294 | 317 | | |
| |||
378 | 401 | | |
379 | 402 | | |
380 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
381 | 407 | | |
382 | 408 | | |
383 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
203 | 217 | | |
204 | 218 | | |
205 | 219 | | |
| |||
277 | 291 | | |
278 | 292 | | |
279 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
280 | 321 | | |
281 | 322 | | |
282 | 323 | | |
283 | 324 | | |
284 | 325 | | |
285 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
286 | 329 | | |
287 | 330 | | |
288 | 331 | | |
| |||
0 commit comments