Alibaba Cloud CDN allows you to rewrite URL parameters in requests before they are redirected to origin servers. You can ignore all parameters, add parameters, delete parameters, retain parameters, and modify parameters.

Background information

After you enable Alibaba Cloud CDN to rewrite URL parameters in back-to-origin requests, the query strings in URLs are rewritten. You can create more than one rewrite rule. Rewrite rules are prioritized in the following descending order: Add > Delete > Ignore Parameters or Reserve Only > Modify. If you create more than one rewrite rule for the same parameter, only the rewrite rule with the highest priority applies.
Note The Ignore Parameters and Reserve Only rules are mutually exclusive. Do not configure them for the same domain name.
URL rewrite

Caution

URL parameter rewrite rules may conflict with the enhance break rule of URI rewrite and the Ignore Parameters rules of parameter filtering. Make sure that these rules do not conflict with each other. Otherwise, the most recent configuration takes effect.
Note
  • URL parameters in back-to-origin requests are rewritten on CDN nodes. The internal CDN links are not affected. The cache keys remain unchanged.
  • Ignore Parameters on CDN nodes. The internal CDN links are affected. The cache keys are also rewritten.

Procedure

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
  4. In the left-side management pane of the domain name, click Back-to-origin.
  5. Click the Parameter Rewrite tab.
  6. Turn on Rewrite Parameters.
  7. In the Rewrite Parameters dialog box, set the required parameters.

    You can configure different types of rewrite rule or specify multiple parameters in a rewrite rule based on your business requirements. For more information, see Configuration examples.

    Parameter rewrite
  8. Click OK to apply the rewrite rule.

    To modify a rewrite rule, find the rule on the Rewrite Parameters tab, and click Modify in the Actions column.

    Parameter rewrite

Configuration examples

  • Example: Ignore all URL parameters

    1
    Parameter Example
    Ignore Parameters Enabled
    Add Disabled
    Delete Disabled
    Reserve Only Disabled
    Modify Disabled
    Expected result Original request: http://example.com/index.html?code1=1&code2=2&code3=3

    Final request: http://example.com/index.html

  • Example 2: Retain specified parameters

    2
    Parameter Example
    Ignore Parameters Enabled
    Add Disabled
    Delete Disabled
    Reserve Only code2
    Modify Disabled
    Expected result Original request: http://example.com/index.html?code1=1&code2=2&code3=3

    Final request: http://example.com/index.html?code2=2

  • Example 3: Add specified parameters, delete specified parameters, and modify specified parameters

    3
    Parameter Example
    Ignore Parameters Enabled
    Add code4=4
    Delete code2
    Reserve Only Disabled
    Modify code3=0
    Expected result Original request: http://example.com/index.html?code1=1&code2=2&code3=3

    Final request: http://example.com/index.html?code1=1&code3=0&code4=4