rewrite_url
Version: v2025-01-13 | Includes use: Yes |
---|
Behavior name: Modify Outgoing Request Path
Modifies the path of incoming requests to forward to the origin. This helps you offload URL-rewriting tasks to the edge to increase the origin server's performance, allows you to redirect links to different targets without changing markup, and hides your original directory structure.
Except for regular expression replacements, this behavior manipulates path expressions that start and end with a /
character.
Note: This behavior's rewrite operations can't override any of the
base_directory
behavior's settings.
Default behavior
These samples reflect the behavior's default settings. You can use these as is in your configurations or make adjustments based on the behavior's available options.
data "akamai_property_rules_builder" "rewrite_url" {
rules_v2025_02_18 {
name = "Modify Outgoing Request Path"
comments = "Modifies the path of incoming requests to forward to the origin."
behavior {
rewrite_url {
behavior = "REPLACE"
match = ""
target_path = ""
match_multiple = false
keep_query_string = true
}
}
}
}
"behaviors": [
{
"name": "rewriteUrl",
"options": {
"behavior": "REPLACE",
"match": "",
"targetPath": "",
"matchMultiple": false,
"keepQueryString": true
}
}
]
Options
Option | Description |
---|---|
behavior |
The action to perform on the path. Value is one of:
|
match |
When
behavior is REMOVE or REPLACE specifies the part of the incoming path you'd like to remove or modify.
|
match_regex |
When
behavior is set to REGEX_REPLACE specifies the Perl-compatible regular expression to replace with target_regex .
|
target_regex |
When
behavior is set to REGEX_REPLACE this replaces whatever the match_regex field matches. Value range is $1 -$9 .
|
target_path |
Replaces whatever the
match field matches in the incoming request's path.
|
target_pathPrepend |
Specifies a path to prepend to the incoming request's URL.
|
target_url |
Specifies the full path to request from the origin.
|
match_multiple |
When enabled, replaces all potential matches rather than only the first.
|
keep_query_string |
When enabled, retains the original path's query parameters.
|
Updated 27 minutes ago