All Products
Search
Document Center

Microservices Engine:UpdateGatewayRouteWafStatus

Last Updated:Aug 28, 2026

Enables or disables Web Application Firewall (WAF) protection for a Cloud Native Gateway route.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mse:UpdateGatewayRouteWafStatus

update

*Gateway

acs:mse:{#regionId}:{#accountId}:instance/{#GatewayUniqueId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RouteId

integer

Yes

The ID of the route.

645

GatewayUniqueId

string

Yes

The unique ID of the gateway.

gw-86575c0bc9f04ecfbacb92b8e392****

AcceptLanguage

string

No

The language of the response. Valid values:

  • zh: Chinese

  • en: English

zh

EnableWaf

boolean

Yes

Specifies whether to enable WAF protection.

true

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

7466566F-F30F-4A29-965D-3E0AF21D****

HttpStatusCode

integer

HTTP status code.

200

Message

string

Response message.

success

Code

integer

Status code. 200 indicates success.

200

Success

boolean

Whether the request succeeded.

  • true: The request was successful.

  • false: The request failed.

true

Data

object

The returned data.

Id

integer

The ID of the route.

12

Name

string

The name of the route.

test

GatewayUniqueId

string

The unique ID of the gateway.

gw-7ea3da97b96543e19f6c597cd4a9****

GatewayId

integer

The ID of the gateway.

102

DefaultServiceId

integer

The default service ID.

1

DefaultServiceName

string

The default service name.

test

Status

integer

The status of the route.

1

GmtCreate

string

The creation time.

2022-01-26T09:52:41.000+0000

GmtModified

string

The modification time.

2022-02-24T06:08:29.230+0000

RouteOrder

integer

The sequence number of the route.

1

Predicates

string

The matching rule.

{\"PathPredicates\":{\"Path\":\"/metas\",\"Type\":\"PRE\",\"IgnoreCase\":false}}

RoutePredicates

object

Route matching configuration.

PathPredicates

object

Path matching configuration.

Path

string

The path.

/zookeeper/mmgw/unlogined/common.getBu

Type

string

The matching type.

PRE

IgnoreCase

boolean

Whether matching is case-insensitive.

true

MethodPredicates

array

Method matching rules.

string

The method.

GET

HeaderPredicates

array<object>

Request header matching rules.

object

The request header.

Key

string

The key of the request header.

alibo

Value

string

The value of the request header.

200

Type

string

The matching type.

PRE

QueryPredicates

array<object>

The parameter matching rules.

object

The parameter.

Key

string

The name of the parameter.

instanceId

Value

string

The value of the parameter.

test

Type

string

The type.

PRE

DomainId

integer

The domain ID.

235

DomainName

string

The domain name.

nbhamster.com

Services

string

The information about services.

[{\"Percent\":100,\"ServiceId\":126}]

RouteServices

array<object>

The information about services.

object

The information about services.

ServiceId

integer

The ID of the service.

547

ServiceName

string

The name of the service.

b-service

Percent

integer

The weight.

80

Version

string

The version of the service.

v1

Name

string

The name of the service.

test-aixue-gray

SourceType

string

The source type of the service.

K8s

Namespace

string

The namespace.

default

GroupName

string

Service group name.

DEFAULT_GROUP

HTTPRewrite

object

URL rewrite configuration.

Status

string

The HTTP status.

off

Path

string

The HTTP request path.

/test/client

Host

string

The domain name.

aliyuncs.com

PathType

string

The path type of the HTTP request.

PRE

Pattern

string

The matching pattern.

/test

Substitution

string

The replacement.

test

HeaderOp

object

The header settings.

Status

string

The status.

off

HeaderOpItems

array<object>

The policy.

object

The policy.

DirectionType

string

The request or response.

Response

OpType

string

The operation type.

Add

Key

string

The header key.

debug

Value

string

The header value.

test

DestinationType

string

The destination service type.

Single

DirectResponse

object

Service mock configuration.

Code

integer

The return value.

200

Body

string

The mock return value.

[{\"key\":\"h68d13466.sqa.eu95\",\"dims\":\"groupName=All}]

Cors

object

The configuration for cross-origin resource sharing (CORS).

Status

string

The status.

off

AllowOrigins

string

The origins allowed.

*

AllowMethods

string

The methods allowed.

GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH

AllowHeaders

string

The headers allowed.

*

ExposeHeaders

string

The response headers.

*

TimeUnit

string

The time unit.

s

UnitNum

integer

The unit number.

1

AllowCredentials

boolean

The credentials allowed.

true

Timeout

object

The timeout configuration.

UnitNum

integer

The unit number.

10

TimeUnit

string

The time unit.

s

Status

string

The status.

off

Retry

object

The retry configuration.

Attempts

integer

Maximum retry attempts.

1

RetryOn

array

The retry condition.

string

The retry condition.

5xx

HttpCodes

array

The HTTP status code.

string

The HTTP status code.

500

Status

string

The retry status.

on

DomainIdList

array

The list of domain IDs.

integer

The list of domain IDs.

1

DomainNameList

array

The domain names.

string

The domain names.

test.com

Redirect

object

Redirect configuration.

Code

integer

The response code returned.

200

Host

string

The hostname.

ww.al.c

Path

string

The path.

/

EnableWaf

boolean

Whether WAF is enabled.

0

Examples

Success response

JSON format

{
  "RequestId": "7466566F-F30F-4A29-965D-3E0AF21D****",
  "HttpStatusCode": 200,
  "Message": "success",
  "Code": 200,
  "Success": true,
  "Data": {
    "Id": 12,
    "Name": "test",
    "GatewayUniqueId": "gw-7ea3da97b96543e19f6c597cd4a9****",
    "GatewayId": 102,
    "DefaultServiceId": 1,
    "DefaultServiceName": "test",
    "Status": 1,
    "GmtCreate": "2022-01-26T09:52:41.000+0000",
    "GmtModified": "2022-02-24T06:08:29.230+0000",
    "RouteOrder": 1,
    "Predicates": "{\\\"PathPredicates\\\":{\\\"Path\\\":\\\"/metas\\\",\\\"Type\\\":\\\"PRE\\\",\\\"IgnoreCase\\\":false}}",
    "RoutePredicates": {
      "PathPredicates": {
        "Path": "/zookeeper/mmgw/unlogined/common.getBu",
        "Type": "PRE",
        "IgnoreCase": true
      },
      "MethodPredicates": [
        "GET"
      ],
      "HeaderPredicates": [
        {
          "Key": "alibo",
          "Value": "200",
          "Type": "PRE"
        }
      ],
      "QueryPredicates": [
        {
          "Key": "instanceId",
          "Value": "test",
          "Type": "PRE"
        }
      ]
    },
    "DomainId": 235,
    "DomainName": "nbhamster.com",
    "Services": "[{\\\"Percent\\\":100,\\\"ServiceId\\\":126}]",
    "RouteServices": [
      {
        "ServiceId": 547,
        "ServiceName": "b-service",
        "Percent": 80,
        "Version": "v1",
        "Name": "test-aixue-gray",
        "SourceType": "K8s",
        "Namespace": "default",
        "GroupName": "DEFAULT_GROUP"
      }
    ],
    "HTTPRewrite": {
      "Status": "off",
      "Path": "/test/client",
      "Host": "aliyuncs.com",
      "PathType": "PRE",
      "Pattern": "/test",
      "Substitution": "test"
    },
    "HeaderOp": {
      "Status": "off",
      "HeaderOpItems": [
        {
          "DirectionType": "Response",
          "OpType": "Add",
          "Key": "debug",
          "Value": "test"
        }
      ]
    },
    "DestinationType": "Single",
    "DirectResponse": {
      "Code": 200,
      "Body": "[{\\\"key\\\":\\\"h68d13466.sqa.eu95\\\",\\\"dims\\\":\\\"groupName=All}]"
    },
    "Cors": {
      "Status": "off",
      "AllowOrigins": "*",
      "AllowMethods": "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH",
      "AllowHeaders": "*",
      "ExposeHeaders": "*",
      "TimeUnit": "s",
      "UnitNum": 1,
      "AllowCredentials": true
    },
    "Timeout": {
      "UnitNum": 10,
      "TimeUnit": "s",
      "Status": "off"
    },
    "Retry": {
      "Attempts": 1,
      "RetryOn": [
        "5xx"
      ],
      "HttpCodes": [
        "500"
      ],
      "Status": "on"
    },
    "DomainIdList": [
      1
    ],
    "DomainNameList": [
      "test.com"
    ],
    "Redirect": {
      "Code": 200,
      "Host": "ww.al.c",
      "Path": "/"
    },
    "EnableWaf": true
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 IllegalRequest Invalid request:%s Invalid request: %s
400 InvalidParameter Parameter error:%s Request parameter error: %s
500 InternalError Console error. Try again later:%s Console error. Try again later: %s
403 NoPermission You are not authorized to perform this operation:%s You do not have the permission to use this interface:%s
404 NotFound Not found:%s The resource does not exist:%s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.