All Products
Search
Document Center

Global Accelerator:Add and manage forwarding rules

Last Updated:May 09, 2026

Forwarding rules let you route incoming requests to different endpoint groups based on request attributes — domain names, paths, HTTP headers, cookies, and more. Each rule combines matching conditions with one or more actions, giving you fine-grained control over how Global Accelerator (GA) handles traffic.

Common use cases:

  • Route requests for different domains or paths to separate backend services

  • Redirect HTTP traffic to HTTPS

  • Block traffic from specific domains or IP ranges

  • Mirror traffic to a secondary endpoint group for testing or monitoring

  • Rewrite URLs or modify HTTP headers before forwarding requests

How forwarding rules work

Rule types

Every listener has two types of forwarding rules:

  • Default forwarding rule: Created automatically when you create a listener and linked to the default endpoint group. Each listener has exactly one default rule. Its priority cannot be changed, and it cannot be modified or deleted.

  • Custom forwarding rules: Rules you create after the listener is set up. A listener can have multiple custom rules, and you can adjust their priorities.

Rule components

Each forwarding rule consists of forwarding conditions and forwarding actions. The actions are applied only when a request matches all conditions in the rule.

The available condition types and action types depend on the listener protocol:

Listener protocol

Forwarding conditions

Forwarding actions

TCP

Domain Name

Forward to, Drop (Block Traffic)

HTTP or HTTPS

Host, Path, HTTP Header, HTTP Request Method, Cookie, Source IP, Query String

Forward to, Redirect to, Mirror traffic to, Return fixed response, Rewrite, Insert header, Remove header, Drop (Block Traffic)

Note

If your standard GA instance supports only the Domain Name and Path forwarding conditions and the Forward to action, your instance version may not support other types. Contact your business manager to upgrade the instance.

Note

If your standard GA instance does not support forwarding rules for TCP listeners, your instance version may not support this feature. Contact your business manager to upgrade.

Condition logic

Understanding how conditions combine is essential for designing effective rules.

Within a single rule, all conditions must match (AND logic). A request is forwarded only when it satisfies every condition in the rule.

Within a single condition, multiple values use OR logic. For example, a Host condition with two domain names matches if the request hostname equals either one.

The following table summarizes how each condition type behaves when used multiple times in the same rule:

Condition type

Multiple instances in one rule

Multiple values in one condition

Host

Not allowed — only one per rule

OR

Path

OR

OR

HTTP Header

AND (keys must be unique)

OR

HTTP Request Method

Not allowed — only one per rule

OR

Cookie

AND

OR

Source IP

Not allowed — only one per rule

OR

Query String

AND

OR

Domain Name (TCP)

OR

OR

How requests are matched

image

  1. Requests are evaluated against custom forwarding rules in descending order of priority. A lower rule number means higher priority.

    • If the request matches a custom rule — that is, it satisfies all conditions — the corresponding actions are applied immediately.

    • If the request does not match, it is checked against the next rule in priority order.

  2. If the request does not match any custom rule, the default forwarding rule applies. The request is forwarded to the default endpoint group.

If the listener has multiple default endpoint groups, the default rule distributes traffic based on the endpoint group traffic distribution settings. For details, see Distribute traffic across endpoint groups in different scenarios.

Note

Setting the path to /* matches all paths. To handle unexpected requests with a catch-all rule, set the path condition to /* and configure the action to return a fixed response with a 404 or 403 status code. Then drag the rule to the second-to-last position in the rule list.

Prerequisites

Before you begin, ensure that you have:

Add a forwarding rule

  1. Log on to the GA console.

  2. On the Instances page, find the target GA instance and click Configure Listener in the Actions column.

  3. On the Listeners tab, click the listener ID.

  4. On the listener details page, click the Forwarding Rule tab.

  5. Click Add Forwarding Rule, configure the rule using the parameter tables below, and then click OK. To add multiple rules at once, click Add New Rule.

  6. To add another rule, click Add Forwarding Rule again.

HTTP or HTTPS listener parameters

Parameter

Description

Policy Name

The name of the custom forwarding rule.

If (Matching All Conditions)

Select one or more forwarding condition types. Click +Add Forwarding Condition to add more conditions. For details on each type, see Forwarding conditions reference.

Then

Select one or more forwarding action types. Click +Add Action to add more actions. For details and constraints, see Forwarding actions reference.

TCP listener parameters

Important

For TCP listener forwarding rules to take effect, the backend service must use HTTPS. Rules that target backends using other protocols do not take effect.

Parameter

Description

Name

The name of the custom forwarding rule.

If (Matching All Conditions)

Only the Domain Name condition type is supported. Exact-match domain names, wildcard domain names, and regular expressions are supported. See Domain name configuration rules for forwarding conditions for format details. Click +Add Domain Name to add multiple domain names. The logical relationship between domain names is OR. Example: *.example.com

The Forwarding Action

Select Forward to or Drop (Block Traffic). A rule can contain only one action of either type. For Forward to endpoint group restrictions, see Forward to.

Forwarding conditions reference

Host

Matches the hostname in the request. Supports exact-match domain names, wildcard domain names, and regular expressions. See Configure domain names in forwarding conditions for format rules.

  • Only one Host condition per rule.

  • Multiple domain names within the condition use OR logic.

Example: *.example.com

Path

Matches the URL path in the request. Supports exact-match paths, wildcard paths, and regular expressions. See Configure paths in forwarding conditions for format rules.

  • Multiple Path conditions per rule use OR logic.

  • Multiple paths within a single condition use OR logic.

Example: If the URL is www.example.com/test/test1?x=1&y=2, set the path to /test/*.

HTTP Header

Matches a specific HTTP header key-value pair. Enter the header name in Key is and the value in Value is.

  • Multiple HTTP Header conditions per rule use AND logic. Keys must be unique across conditions.

  • Multiple values within a single condition use OR logic. HTTP header values within a single condition must be unique.

Example: Key user-agent, value *Mozilla/4.0*

HTTP Request Method

Matches the HTTP request method. Valid values: HEAD, GET, POST, OPTIONS, PUT, PATCH, DELETE.

  • Only one HTTP Request Method condition per rule.

  • Multiple methods within the condition use OR logic.

Cookie

Matches cookie key-value pairs.

  • Multiple Cookie conditions per rule use AND logic.

  • Multiple key-value pairs within a single condition use OR logic.

Example: key:value

Source IP

Matches client IP addresses or CIDR blocks.

  • Only one Source IP condition per rule.

  • Multiple entries within the condition use OR logic.

Example IP address: 1.1.XX.XX/32. Example CIDR block: 2.2.XX.XX/24

Query String

Matches URL query string key-value pairs.

  • Multiple Query String conditions per rule use AND logic.

  • Multiple key-value pairs within a single condition use OR logic.

Example: If the URL is www.example.com/test/test1?x=1&y=2, set the parameters to x:1 or y:2.

Forwarding actions reference

A forwarding rule must include exactly one of these three actions: Forward to, Redirect to, or Return fixed response. This ensures that client requests are always handled.

If a rule includes Rewrite, Insert header, or Remove header, it must also include a Forward to action. Place those actions before Forward to.

Forward to

Forwards matched requests to the specified endpoint group.

Endpoint group selection depends on your billing method:

Billing method

Allowed endpoint groups

Pay-as-you-go

Multiple endpoint groups (default and virtual), with one per region. Default quota: up to 10 endpoint groups. Contact your account manager for a higher quota.

Subscription

One virtual endpoint group (HTTP/HTTPS listeners); one default or virtual endpoint group (TCP listeners).

Redirect to

Redirects matched requests to a different URL. Specify the Protocol, Status Code, Host, Port, Path, and Query string. The Protocol, Host, Port, Path, and Query parameters cannot all be empty or use their default values at the same time.

For advanced Path configuration rules, see Advanced path configurations for rewrites and redirects.

Mirror traffic to

Sends a copy of matched request traffic to the specified endpoint group, while the original request continues to the Forward to destination.

Constraints:

  • Traffic mirroring is being rolled out in phases. Contact your account manager to enable it.

  • Only pay-as-you-go GA instances support this action.

  • Must be combined with a Forward to action. Place Mirror traffic to before Forward to.

  • The endpoint groups for Mirror traffic to and Forward to cannot be the same.

  • Only one endpoint group (default or virtual) can be selected for traffic mirroring.

Return fixed response

Returns a static HTTP response to the client. Specify the Response Status Code, Response Body Type, and Response Body.

Rewrite

Rewrites the request URL before forwarding. Specify the Host, Path, and Query String for the rewritten URL. Must be combined with and placed before a Forward to action.

For advanced Path configuration rules, see Advanced path configurations for rewrites and redirects.

Insert header

Inserts or overwrites an HTTP header in the request before forwarding. Enter the header name in Key is and the value in Value is.

Constraints:

  • Keys must be unique across Insert header actions in the same rule.

  • Insert header keys cannot duplicate any Remove header keys in the same rule.

  • Only pay-as-you-go instances support inserting System-defined Request IDs into headers.

Must be placed before the Forward to action.

Remove header

Removes an HTTP header from the request before forwarding. Enter the header name to remove.

Constraints:

  • Keys must be unique across Remove header actions in the same rule.

  • Remove header keys cannot duplicate any Insert header keys in the same rule.

Must be placed before the Forward to action.

Drop (Block Traffic)

Drops the request immediately without forwarding it to any endpoint group.

Manage forwarding rules

Note

The default forwarding rule cannot be edited, reprioritized, or deleted.

Operation

Steps

Edit a forwarding rule

On the Forwarding Rule tab, find the rule, hover over its upper-right corner, and click the 编辑 icon. Edit the rule and click Save.

Change the priority of a forwarding rule

Rules are evaluated from top to bottom, with lower numbers having higher priority. On the Forwarding Rule tab, drag the rule to the desired position, then click Save Priority Changes in the upper-right corner.

Delete a single forwarding rule

On the Forwarding Rule tab, hover over the rule's upper-right corner and click the 删除 icon. Confirm the forwarding rule ID and click OK.

Delete multiple forwarding rules

On the Forwarding Rule tab, select the rules to delete and click Delete in the upper-right corner. Confirm the forwarding rule IDs and click OK.

Usage examples

Forward requests to a specific virtual endpoint group

A web application serves two domains — example.com and example.net — from two separate servers. Both domains are accelerated through GA.

Configure an HTTPS listener with a default endpoint group and bind a default certificate to it. Requests for example.com are forwarded to the default endpoint group. Then add a virtual endpoint group, bind an additional certificate, and create a Host forwarding rule to send example.net traffic to that virtual endpoint group.

The following figure shows the Host forwarding rule configuration for this example.

Forward to virtual endpoint group

Note

For a walkthrough of accelerating multiple HTTPS domains using a single GA instance, see Use a single Global Accelerator instance to accelerate access to multiple HTTPS domain names.

Redirect HTTP requests to HTTPS

When a website migrates from HTTP to HTTPS, existing bookmarks and links using HTTP stop working. Configure a Redirect forwarding rule to automatically send HTTP requests to the equivalent HTTPS URL. By default, this rule returns an HTTP 301 status code.

In this example, HTTP requests on port 80 are redirected to HTTPS on port 443. The following figure shows the Redirect forwarding rule configuration.

重定向

Configure domain-based traffic blocking

A website serves traffic through example.com and uses a Content Delivery Network (CDN) as its backend service in GA. Because CDN services are multi-tenant and share IP addresses, other CDN tenants could resolve different domains to the same accelerated IP address and route traffic through your GA instance — generating unexpected costs and potential security risks.

To prevent this, configure forwarding rules that allow only requests for example.com and drop all others. In this example, requests for example.com are forwarded to the backend endpoint group. Requests for any other domain are dropped with the Drop (Block Traffic) action.

域名访问控制.png

API reference

API

Description

CreateForwardingRules

Creates forwarding rules

UpdateForwardingRules

Updates forwarding rules

ListForwardingRules

Queries forwarding rules

DeleteForwardingRules

Deletes forwarding rules