Create rule via API
Use the Rulesets API to create a redirect rule via API.
Add redirect rules to the entry point ruleset of the http_request_dynamic_redirect
phase at the zone level. Refer to the Rulesets API documentation for more information on creating a ruleset and supplying a list of rules for the ruleset.
A redirect rule must have:
action
set toredirect
- An
action_parameters
object with additional configuration settings — refer to Available settings for details.
The following request of the Create a zone ruleset operation creates a phase entry point ruleset for the http_request_dynamic_redirect
phase at the zone level, and defines a single redirect rule with a dynamic URL redirect. Use this operation if you have not created a phase entry point ruleset for the http_request_dynamic_redirect
phase yet.
Response
If there is already a phase entry point ruleset for the http_request_dynamic_redirect
phase, use the Update a zone ruleset operation instead, like in the following example:
Response
The API token used in API requests to manage redirect rules must have at least the following permission:
- Zone > Dynamic Redirect > Edit