Updated on 2025-09-28 GMT+08:00

Querying Forwarding Policies

Function

This API is used to query all forwarding policies.

Constraints

This API has the following constraints:

  • Parameters marker, limit, and page_reverse are used for pagination query.

  • Parameters marker and page_reverse take effect only when they are used together with parameter limit.

Calling Method

For details, see Calling APIs.

URI

GET /v3/{project_id}/elb/l7policies

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Constraints: N/A

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

Default value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

marker

No

String

Definition: Specifies the ID of the last record on the previous page.

Constraints:

  • This parameter must be used together with limit.

  • If the parameter is not specified, only resources on the first page are queried.

  • This parameter cannot be left blank or set to an invalid ID.

Range: N/A

Default value: N/A

limit

No

Integer

Definition: Specifies the number of records returned on each page.

Constraints: N/A

Range: 0 to 2000

Default value: 2000

page_reverse

No

Boolean

Definition: Specifies whether to use reverse query.

Constraints:

  • This parameter must be used together with limit.

  • If page_reverse is set to true and you want to query the resources on the previous page, set the value of marker to the value of previous_marker.

Range:

  • true: Query resources on the previous page.

  • false: Query resources on the next page.

Default value: false

enterprise_project_id

No

Array of strings

Definition: Specifies the ID of the enterprise project.

Multiple values can be used for query in the format of: enterprise_project_id=xxx&enterprise_project_id=xxx.

Constraints:

  • If enterprise_project_id is not specified, resources in all enterprise projects are queried by default. Fine-grained authorization is performed. The elb:l7policies:list permission must be assigned to the user group.

  • If enterprise_project_id is specified, the value can be a specific enterprise project ID or all_granted_eps. If the value is a specific enterprise project ID, only resources in the enterprise project are queried. If the value is all_granted_eps, resources in the enterprise projects with the elb:l7policies:list permission are queried.

Range: N/A

Default value: N/A

id

No

Array of strings

Definition: Specifies the forwarding policy ID.

Multiple IDs can be used for query in the format of id=xxx&id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

name

No

Array of strings

Definition: Specifies the forwarding policy name.

Multiple names can be used for query in the format of name=xxx&name=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

description

No

Array of strings

Definition: Provides supplementary information about the forwarding policy.

Multiple descriptions can be used for query in the format of description=xxx&description=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

admin_state_up

No

Boolean

Definition: Specifies the administrative status of the forwarding policy.

Constraints: N/A

Range: N/A

Default value: N/A

listener_id

No

Array of strings

Definition: Specifies the ID of the listener with which the forwarding policy is associated.

Multiple IDs can be used for query in the format of listener_id=xxx&listener_id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

position

No

Array of integers

Definition: Specifies the priority of the forwarding policy.

Multiple priorities can be used for query in the format of position=xxx&position=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

action

No

Array of strings

Definition: Specifies the action of the forwarding policy.

Multiple actions can be used for query in the format of action=xxx&action=xxx.

Constraints: N/A

Range:

  • REDIRECT_TO_POOL: Requests are forwarded to another backend server group.

  • REDIRECT_TO_LISTENER: Requests are redirected to an HTTPS listener.

  • REDIRECT_TO_URL: Requests are redirected to another URL.

  • FIXED_RESPONSE: A fixed response body is returned.

Default value: N/A

redirect_url

No

Array of strings

Definition: Specifies the URL to which requests will be forwarded.

Multiple URLs can be used for query in the format of redirect_url=xxx&redirect_url=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

This parameter is unsupported. Please do not use it.

redirect_pool_id

No

Array of strings

Definition: Specifies the ID of the backend server group to which requests will be forwarded.

Multiple IDs can be used for query in the format of redirect_pool_id=xxx&redirect_pool_id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

redirect_listener_id

No

Array of strings

Definition: Specifies the ID of the listener to which requests are redirected.

Multiple IDs can be used for query in the format of redirect_listener_id=xxx&redirect_listener_id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

provisioning_status

No

Array of strings

Definition: Specifies the provisioning status of the forwarding policy.

Multiple provisioning statuses can be used for query in the format of provisioning_status=xxx&provisioning_status=xxx.

Constraints: N/A

Range:

  • ACTIVE: The forwarding policy is provisioned successfully.

  • ERROR: The forwarding policy has the same rule as another forwarding policy added to the same listener.

Default value: N/A

display_all_rules

No

Boolean

Definition: Specifies whether to display details about the forwarding rules in the forwarding policy.

Constraints: N/A

Range:

  • true: Details about the forwarding rules are displayed.

  • false: Only the rule IDs are displayed.

Default value: N/A

priority

No

Array of integers

Definition: Specifies the priority of the forwarding policy. A smaller value indicates a higher priority.

Multiple priorities can be used for query in the format of priority=xxx&priority=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: Specifies the token used for IAM authentication.

Constraints: N/A

Range: N/A

Default value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Definition: Specifies the request ID.

Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-).

page_info

PageInfo object

Definition: Specifies the pagination information.

l7policies

Array of L7Policy objects

Definition: Lists the forwarding policies.

Table 5 PageInfo

Parameter

Type

Description

previous_marker

String

Definition: Specifies the ID of the first record in the pagination query result. If page_reverse is set to true, this parameter is used together to query resources on the previous page.

Range: N/A

next_marker

String

Definition: Specifies the ID of the last record in the pagination query result. It is usually used to query resources on the next page.

Range: N/A

current_count

Integer

Definition: Specifies the number of records returned on the current page.

Range: N/A

Table 6 L7Policy

Parameter

Type

Description

action

String

Definition: Specifies the action of the forwarding policy.

Range:

  • REDIRECT_TO_POOL: Requests are forwarded to another backend server group.

  • REDIRECT_TO_LISTENER: Requests are redirected to an HTTPS listener.

  • REDIRECT_TO_URL: Requests are redirected to another URL.

  • FIXED_RESPONSE: A fixed response body is returned.

admin_state_up

Boolean

Definition: Specifies the administrative status of the forwarding policy.

Range: The value can only be true.

description

String

Definition: Provides supplementary information about the forwarding policy.

Range: N/A

id

String

Definition: Specifies the forwarding policy ID.

Range: N/A

listener_id

String

Definition: Specifies the ID of the listener with which the forwarding policy is associated.

Range: N/A

name

String

Definition: Specifies the forwarding policy name.

Range: N/A

position

Integer

Definition: Specifies the priority of the forwarding policy. The priority cannot be updated.

This parameter is unsupported. Please do not use it.

priority

Integer

Definition: Specifies the priority of the forwarding policy. A smaller value indicates a higher priority.

Range:

  • If action is set to REDIRECT_TO_LISTENER, the priority ranges from 0 to 10,000.

  • If action is set to other values, the priority ranges from 1 to 10,000.

project_id

String

Definition: Specifies the ID of the project where the forwarding policy is used.

Range: N/A

provisioning_status

String

Definition: Specifies the provisioning status of the forwarding policy.

Range:

  • ACTIVE (default): The forwarding policy is provisioned successfully.

redirect_pool_id

String

Definition: Specifies the ID of the backend server group to which requests will be forwarded.

Range: N/A

redirect_listener_id

String

Definition: Specifies the ID of the listener to which requests are redirected.

Range: N/A

redirect_url

String

Definition: Specifies the URL to which requests will be forwarded.

Range: The value must be in the format of protocol://host:port/path?query.

This parameter is unsupported. Please do not use it.

rules

Array of RuleRef objects

Definition: Lists the forwarding rules in the forwarding policy.

redirect_url_config

RedirectUrlConfig object

Definition: Specifies the URL to which requests are forwarded.

redirect_pools_config

Array of RedirectPoolsConfig objects

Definition: Specifies the backend server groups that the requests are forwarded to. This parameter takes effect only when enhance_l7policy_enable is set to true. If this parameter is specified and enhance_l7policy_enable is set to false, an error will be returned.

redirect_pools_sticky_session_config

RedirectPoolsStickySessionConfig object

Definition: Specifies whether to enable sticky session for backend server groups configured for a forwarding policy. The load balancer generates a cookie after it receives a request from a client. All subsequent requests with the same cookie are routed to the same backend server group.

redirect_pools_extend_config

RedirectPoolsExtendConfig object

Definition: Specifies the backend server group that requests are forwarded to.

fixed_response_config

FixtedResponseConfig object

Definition: Specifies the configuration of the page that will be returned.

created_at

String

Definition: Specifies the creation time.

Range: The value must be a UTC time in the yyyy-MM-dd'T'HH:mm:ss'Z' format.

updated_at

String

Definition: Specifies the update time.

Range: The value must be a UTC time in the yyyy-MM-dd'T'HH:mm:ss'Z' format.

enterprise_project_id

String

Definition: Specifies the enterprise project ID.

Range: N/A

Table 7 RuleRef

Parameter

Type

Description

id

String

Definition: Specifies the forwarding rule ID.

Range: N/A

Table 8 RedirectUrlConfig

Parameter

Type

Description

protocol

String

Definition: Specifies the protocol for redirection.

Range:

  • HTTP

  • HTTPS

  • ${protocol}: indicates that the protocol in the request will be used.

host

String

Definition: Specifies the name of the host that requests are redirected to.

Range: The value can contain only letters, digits, hyphens (-), and periods (.) and must start with a letter or digit.

port

String

Definition: Specifies the port that requests are redirected to.

Range: N/A

path

String

Definition: Specifies the path that requests are redirected to.

Range: The value can contain only letters, digits, and special characters: _~';@^-%#&$.*+?,=!:|\/()[]{} and must start with a slash (/).

query

String

Definition: Specifies the query string set in the URL for redirection. The following is an example:

In the URL https://www.example.com:8080/elb?type=loadbalancer, if this parameter is set to ${query}&name=my_name, the URL will be redirected to https://www.example.com:8080/elb?type=loadbalancer&name=my_name. In the example, ${query} indicates type=loadbalancer.

Range: The value can contain only letters, digits, and the special characters: !$&'()*+,-./:;=?@^_`. The letters are case-sensitive. $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the requested URL.

status_code

String

Definition: Specifies the status code returned after the requests are redirected.

Range:

  • 301

  • 302

  • 303

  • 307

  • 308

Table 9 RedirectPoolsConfig

Parameter

Type

Description

pool_id

String

Definition: Specifies the backend server group ID.

Range: N/A

weight

Integer

Definition: Specifies the weight of the backend server group. Requests are routed to backend server groups based on their weights. The larger the weight is, the higher proportion of requests the backend server group receives. If the weight is set to 0, the backend server group will not accept new requests.

Range: 0 to 100

Table 10 RedirectPoolsStickySessionConfig

Parameter

Type

Description

enable

Boolean

Definition: Specifies whether to enable sticky session for backend server groups configured in a forwarding policy.

Default value: false, indicating that sticky session is disabled.

timeout

Integer

Definition: Specifies the stickiness duration, in minutes.

Range: 1 to 1440

Table 11 RedirectPoolsExtendConfig

Parameter

Type

Description

rewrite_url_enable

Boolean

Definition: Specifies whether to set rewrite_url_enable to true.

Range: The value can be true (enable this option) or false (disable this option).

rewrite_url_config

RewriteUrlConfig object

Definition: Specifies the URL for the backend server group that requests are forwarded to.

Table 12 RewriteUrlConfig

Parameter

Type

Description

host

String

Definition: Specifies the domain name of the host that requests are redirected to.

Range: The value can contain letters, digits, hyphens (-), and periods (.), and must start with a letter or digit.

path

String

Definition: Specifies the path that requests are redirected to. $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. If the number of regular expression match groups is less than the specified number, ${path} is empty. If the dollar sign ($) is followed by a letter, the matching result is empty until the next special character appears, for example, $abc#123, and the matching result is #123. If the dollar sign ($) is followed by a special character, for example, $#, the matching result is $#.

Range: The value must start with a slash (/) and can contain only letters, digits, and special characters: _~';@^-%#&$.+?,=!:|/()

query

String

Definition: Specifies the query string set in the URL for redirection. $1, $2, $3, and all the way to $9 match the wildcard asterisk (*) in the request URL. If the number of regular expression match groups is less than the specified number, ${path} is empty. If the dollar sign ($) is followed by a letter, the matching result is empty until the next special character appears, for example, $abc#123, and the matching result is #123. If the dollar sign ($) is followed by a special character, for example, $#, the matching result is $#.

Range: The value can contain only letters, digits, and the special characters: !$&'()+,-./:;=?@^_`. The letters are case-sensitive.

Table 13 FixtedResponseConfig

Parameter

Type

Description

status_code

String

Definition: Specifies the HTTP status code.

Range: 200-299, 400-499, 500-599

content_type

String

Definition: Specifies the format of the returned body.

Range:

  • text/plain

  • text/css

  • text/html

  • application/javascript

  • application/json

message_body

String

Definition: Specifies the content of the response message body.

Range: N/A

Example Requests

Querying forwarding policies

GET https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/l7policies?display_all_rules=true

Example Responses

Status code: 200

Successful request.

{
  "request_id" : "d3c67339-be91-4813-bb24-85728a5d326a",
  "l7policies" : [ {
    "redirect_pool_id" : "768e9e8c-e7cb-4fef-b24b-af9399dbb240",
    "description" : "",
    "admin_state_up" : true,
    "rules" : [ {
      "id" : "c5c2d625-676b-431e-a4c7-c59cc2664881"
    } ],
    "project_id" : "7a9941d34fc1497d8d0797429ecfd354",
    "listener_id" : "cdb03a19-16b7-4e6b-bfec-047aeec74f56",
    "redirect_url" : null,
    "redirect_url_config" : null,
    "redirect_pools_config" : {
      "pool_id" : "722e9e8c-e7cb-4fef-b24b-af9399dbb240",
      "weight" : 12
    },
    "redirect_pools_sticky_session_config" : {
      "timeout" : 23,
      "enable" : false
    },
    "fixed_response_config" : null,
    "redirect_listener_id" : null,
    "action" : "REDIRECT_TO_POOL",
    "position" : 100,
    "priority" : null,
    "provisioning_status" : "ACTIVE",
    "id" : "01832d99-bbd8-4340-9d0c-6ff8f7a37307",
    "name" : "l7policy-67"
  }, {
    "redirect_pool_id" : null,
    "description" : "",
    "admin_state_up" : true,
    "rules" : [ {
      "id" : "390f3a9f-670d-4ca6-b72c-6be8a48a8a00"
    } ],
    "project_id" : "7a9941d34fc1497d8d0797429ecfd354",
    "listener_id" : "bd782cbf-fb5e-411a-9295-530bdec05058",
    "redirect_url" : null,
    "redirect_url_config" : null,
    "redirect_pools_config" : {
      "pool_id" : "722e9e8c-e7cb-4fef-b24b-af9399dbb240",
      "weight" : 12
    },
    "redirect_pools_sticky_session_config" : {
      "timeout" : 23,
      "enable" : false
    },
    "fixed_response_config" : {
      "content_type" : "text/plain",
      "message_body" : "",
      "status_code" : "207"
    },
    "redirect_listener_id" : null,
    "action" : "FIXED_RESPONSE",
    "position" : 6,
    "priority" : 2,
    "provisioning_status" : "ACTIVE",
    "id" : "049a8635-9754-444e-94aa-678993b39cd6",
    "name" : "l7policy-67"
  } ],
  "page_info" : {
    "next_marker" : "2587d8b1-9e8d-459c-9081-7bccaa075d2b",
    "previous_marker" : "01832d99-bbd8-4340-9d0c-6ff8f7a37307",
    "current_count" : 2
  }
}

Status Codes

Status Code

Description

200

Successful request.

Error Codes

See Error Codes.