Create Redirection

This API is used to create rediection policy for website acceleration or file download service.

1. Request Definition

  • API URL
https://cdn-api.swiftfederation.com/v2.0/services/{serviceId}/redirections
  • Request Method
POST
  • Request Header

Refer to HTTP Request Headers

  • Request Body

Request Body Data Format: JSON

Field Required Type Description
name Mandatory string Policy name for access control.
matchType Mandatory string Policy match type, could be "regex" or "prefix".
match Mandatory string Prefix or regex of url pattern.
priority Optional int Priority weight of access control policy. policy with bigger weight will have higher priority, weight value can not be zero.
redirectionURL Mandatory string Send an HTTP redirect if this policy matches.
statusCode Mandatory int HTTP response code to use if sending an HTTP redirect. Could be "301/302".
  • Request Body Example
{
    "name": "rd3001",
    "matchType": "regex",
    "match": "/*.js",
    "priority": 11,
    "redirectionURL": "http://www.example.com/404.html",
    "statusCode": 301
}


2. Response Definition

  • Response Header

Refer to HTTP Response Headers

  • Response Body
Field Type Description
id int Policy ID number for access control.
name string Policy name for access control.
matchType string Policy match type, could be "regex" or "prefix".
url string Prefix or regex of url pattern.
redirectionURL string Send an HTTP redirect if this policy matches.
statusCode int HTTP response code to use if sending an HTTP redirect. Could be "301/302".
  • Response Body Example
{
    "id": 3001,
    "name": "rd3001",
    "matchType": "regex",
    "match": "/*.js",
    "priority": 11,
    "redirectionURL": "http://www.example.com/404.html",
    "statusCode": 302
}
           Updated 2024-08-26 07:42:13

results matching ""

    No results matching ""