Skip to content

Commit

Permalink
Update readme doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jjngx committed Jul 26, 2023
1 parent 585bedc commit 92a4fa6
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions examples/ingress-resources/path-regex/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
# Support for path regular expressions

NGINX and NGINX Plus support regular expression modifiers for [location](https://nginx.org/en/docs/http/ngx_http_core_module.html#location) directive.
NGINX and NGINX Plus support regular expression modifiers for [location](https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
directive.

The NGINX Ingress Controller provides the following annotations for configuring regular expression support:

* Optional: ```nginx.org/path-regex: "case_sensitive"``` - specifies a preceding regex modifier to be case sensitive (`~*`).
* Optional: ```nginx.org/path-regex: "case_insensitive"``` - specifies a preceding regex modifier to be case sensitive (`~`).
* Optional: ```nginx.org/path-regex: "exact"``` - specifies exact match preceding modifier (`=`).
- Optional: ```nginx.org/path-regex: "case_sensitive"``` - specifies a preceding regex modifier to be case sensitive (`~*`).
- Optional: ```nginx.org/path-regex: "case_insensitive"``` - specifies a preceding regex modifier to be case sensitive (`~`).
- Optional: ```nginx.org/path-regex: "exact"``` - specifies exact match preceding modifier (`=`).

[NGINX documentation](https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#nginx-location-priority) provides additional information about how NGINX and NGINX Plus resolve location priority. Read [it](https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#nginx-location-priority) before using the ``path-regex`` annotation.
[NGINX documentation](https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#nginx-location-priority) provides
additional information about how NGINX and NGINX Plus resolve location priority.
Read [it](https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#nginx-location-priority) before using
the ``path-regex`` annotation.

Nginx uses a specific syntax to decide which location block to use to handle a request. Location blocks live within server blocks (or other location blocks) and are used to decide how to process the request URI, for example:
Nginx uses a specific syntax to decide which location block to use to handle a request.
Location blocks live within server blocks (or other location blocks) and are used to decide how to process
the request URI, for example:

```bash
location optional_modifier location_match {
...
}
```

The ``location_match`` defines what NGINX checks the request URI against. The existence or nonexistence of the modifier in the example affects the way that the Nginx attempts to match the location block. The modifiers you can apply using the ``path-regex`` annotation will cause the associated location block to be interpreted as follows:
The ``location_match`` defines what NGINX checks the request URI against. The existence or nonexistence of the modifier
in the example affects the way that the Nginx attempts to match the location block.
The modifiers you can apply using the ``path-regex`` annotation will cause the associated location block
to be interpreted as follows:

* **no modifier** : No modifiers (no annotation applied) - the location is interpreted as a prefix match. This means that the location given will be matched against the beginning of the request URI to determine a match
- **no modifier** : No modifiers (no annotation applied) - the location is interpreted as a prefix match.
This means that the location given will be matched against the beginning of the request URI to determine a match

* **~** : Tilde modifier (annotation value ``case_sensitive``) - the location is interpreted as a case-sensitive regular expression match
- **~** : Tilde modifier (annotation value ``case_sensitive``) - the location is interpreted as a case-sensitive
regular expression match

* **~***: Tilde and asterisk modifier (annotation value ``case_insensitive``) - the location is interpreted as a case-insensitive regular expression match
- **~***: Tilde and asterisk modifier (annotation value ``case_insensitive``) - the location is interpreted
as a case-insensitive regular expression match

* **=** : Equal sign modifier (annotation value ``exact``) - the location is considered a match if the request URI exactly matches the location provided.
- **=** : Equal sign modifier (annotation value ``exact``) - the location is considered a match if the request
URI exactly matches the location provided.

## Example 1: Case Sensitive RegEx

Expand Down

0 comments on commit 92a4fa6

Please sign in to comment.