Rewrite
Specifies a rewrite configuration for rewriting URL paths.
This class defines a path rewriting rule that can be used to modify the path of incoming requests before they are proxied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rfrom
|
str
|
The path pattern to match and replace. |
required |
rto
|
str
|
The replacement path pattern. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If only one of rfrom or rto is provided. |
Source code in aiorp/rewrite.py
__init__(rfrom, rto)
Initialize the rewrite configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rfrom
|
str
|
The path pattern to match and replace. |
required |
rto
|
str
|
The replacement path pattern. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If only one of rfrom or rto is provided. |
Source code in aiorp/rewrite.py
execute(url)
Rewrite the path of the request URL from current to new value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
URL
|
The url to apply the rewrite to |
required |