rewriteUrl


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.

This behavior's rewrite operations can't override any the base‚ÄčDirectory behavior specifies.

OptionTypeDescriptionRequires
behaviorenum

The action to perform on the path.

{"displayType":"enum","options":["REPLACE","REMOVE","REWRITE","PREPEND","REGEX_REPLACE"],"tag":"select"}
REPLACE

Specify the match and target‚ÄčPath. For example, a match of /path1/ and a target‚ÄčPath of /path1/path2/ changes /path1/page.‚Äčhtml to /path1/path2/page.‚Äčhtml.

REMOVE

Specify the match. For example, a match of /path2/ changes /path1/path2/page.‚Äčhtml to /path1/page.‚Äčhtml.

REWRITE

Specify the target‚ÄčUrl. For example, you can direct traffic to /error/restricted.‚Äčhtml.

PREPEND

Specify the target‚ÄčPath‚ÄčPrepend. For example, if set to /prefix/, /path1/page.‚Äčhtml changes to /prefix/path1/page.‚Äčhtml.

REGEX_‚ÄčREPLACE

Specify the match‚ÄčRegex and target‚ÄčRegex. For example, specifying logo\\.(png\|gif\|jpe?g) and brand\$1 changes logo.‚Äčpng to brand.‚Äčpng.

matchstring

When behavior is REMOVE or REPLACE, specifies the part of the incoming path you'd like to remove or modify.

behavior is either: REMOVE, REPLACE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"behavior","op":"in","value":["REMOVE","REPLACE"]}}
match‚ÄčRegexstring

When behavior is set to REGEX_‚ÄčREPLACE, specifies the Perl-compatible regular expression to replace with target‚ÄčRegex.

behavior is REGEX_‚ÄčREPLACE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"behavior","op":"eq","value":"REGEX_REPLACE"}}
target‚ÄčRegexstring (allows¬†variables)

When behavior is set to REGEX_‚ÄčREPLACE, this replaces whatever the match‚ÄčRegex field matches, along with any captured sequences from \$1 through \$9.

behavior is REGEX_‚ÄčREPLACE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"behavior","op":"eq","value":"REGEX_REPLACE"}}
target‚ÄčPathstring (allows¬†variables)

When behavior is set to REPLACE, this path replaces whatever the match field matches in the incoming request's path.

behavior is REPLACE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"behavior","op":"eq","value":"REPLACE"}}
target‚ÄčPath‚ÄčPrependstring (allows¬†variables)

When behavior is set to PREPEND, specifies a path to prepend to the incoming request's URL.

behavior is PREPEND
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"behavior","op":"eq","value":"PREPEND"}}
target‚ÄčUrlstring (allows¬†variables)

When behavior is set to REWRITE, specifies the full path to request from the origin.

behavior is REWRITE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"behavior","op":"eq","value":"REWRITE"}}
match‚ÄčMultipleboolean

When enabled, replaces all potential matches rather than only the first.

behavior is either: REMOVE, REPLACE, REGEX_‚ÄčREPLACE
{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"behavior","op":"in","value":["REMOVE","REPLACE","REGEX_REPLACE"]}}
keep‚ÄčQuery‚ÄčStringboolean

When enabled, retains the original path's query parameters.

behavior is not REWRITE
{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"behavior","op":"neq","value":"REWRITE"}}