mirror of
https://github.com/fosrl/docs.git
synced 2025-05-13 05:40:41 +01:00
Add clarification about path rules
This commit is contained in:
parent
428657ddd7
commit
575550477c
1 changed files with 28 additions and 8 deletions
|
@ -46,16 +46,36 @@ Right now you can match on the following items:
|
||||||
|
|
||||||
### Path
|
### Path
|
||||||
|
|
||||||
Path match rules allow you to specify URL patterns using simple text and wildcards. A valid pattern can include regular path segments, slashes, and wildcards (\*) which match any characters.
|
Path match rules allow URL patterns defined with plain text and wildcards (`*`) that match any characters. Patterns and URLs are split into segments (using `/`), and **each segment is matched individually**.
|
||||||
Examples:
|
|
||||||
|
#### Examples:
|
||||||
|
- `blog/posts`
|
||||||
|
Matches the exact path `/blog/posts`.
|
||||||
|
|
||||||
|
- `blog/*`
|
||||||
|
Matches any path under `/blog` (e.g., `/blog/travel`).
|
||||||
|
|
||||||
|
- `*/2023/*`
|
||||||
|
Matches paths with `/2023/` as a middle segment (e.g., `/news/2023/summary`).
|
||||||
|
|
||||||
|
- `article*`
|
||||||
|
Matches **segments** starting with "article" (e.g., `/article-123`).
|
||||||
|
|
||||||
|
- `*admin*`
|
||||||
|
Matches **segments** containing "admin" (e.g., `/my-admin-panel`).
|
||||||
|
|
||||||
|
- `personal-*/*`
|
||||||
|
Matches paths where the first segment starts with `blog-` and is followed by any segment (e.g., `/personal-blog/post`).
|
||||||
|
|
||||||
|
#### Segment-by-Segment Matching
|
||||||
|
- **Normalization:**
|
||||||
|
Both patterns and URLs are split into segments. For example, `/blog/journal/entry` becomes `["blog", "journal", "entry"]`, while `/blog*` becomes `["blog*"]`.
|
||||||
|
|
||||||
|
- **Validation:**
|
||||||
|
Each pattern segment must correspond to a URL segment, and wildcards match zero or more characters within that segment. A pattern like `/blog*` only matches the first segment, so URLs with extra segments require additional placeholders (e.g., `/blog*/*`).
|
||||||
|
|
||||||
|
|
||||||
- `blog/posts` - Matches exact path
|
|
||||||
- `blog/*` - Matches all paths under blog
|
|
||||||
- `*/2023/*` - Matches any path with 2023 as a middle segment
|
|
||||||
- `product*` - Matches paths starting with "product"
|
|
||||||
- `*admin*` - Matches any path containing "admin"
|
|
||||||
|
|
||||||
Wildcards can appear anywhere in a segment, and special characters like dashes, underscores, and common punctuation are allowed. Avoid empty segments, double slashes, and non-URL characters.
|
|
||||||
|
|
||||||
### CIDR
|
### CIDR
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue