You can enable Alibaba Cloud CDN to ignore parameters that follow the question mark (?) in URLs. This feature increases the cache hit ratio, reduces the number of requests that are redirected to origin servers, reduces the costs of back-to-origin data transfer, and accelerates content delivery. When you enable the parameter filtering feature, you can specify the parameters that you want Alibaba Cloud CDN to retain.

Overview

The following figure shows three methods that you can use to filter URL parameters: ignore all URL parameters, retain specified URL parameters and ignore other URL parameters, and retain all URL parameters.
Note Authenticating signed URLs has a higher priority than parameter filtering. For HTTP requests whose URLs are signed by using type A signing, their signed URLs contain the query string. Alibaba Cloud CDN must verify signed URLs before it can perform parameter filtering. Parameter filtering is performed only on signed URLs that have passed the authentication. Therefore, parameter filtering does not affect the results of authenticating signed URLs. In addition, the requested resources are cached on CDN nodes based on the hash keys that are generated by parameter filtering. For more information about authenticating with URL signing, see URL signing.
Retain parameters
Feature Description
Parameter Filtering

After you enable Parameter Filtering, Alibaba Cloud CDN deletes the parameters that follow the question mark (?) from request URLs.This increases the cache hit ratio.

For example, the first time http://www.****.com/1.jpg is visited, the requested resource is not cached on CDN nodes. Therefore, Alibaba Cloud CDN must retrieve the requested resource from the origin server. When http://www.****.com/1.jpg?test1 is visited, the URL parameters that follow the question mark (?) are deletedbecause parameter filtering is enabled. The request can directly hit the cached resource of http://www.****.com/1.jpg.

Parameter Filtering+Retain Specified Parameters After you enable Parameter Filtering and specify the parameters that you want to retain, the specified parameters that follow the question mark (?) in request URLsare retained. Other parameters are deleted.
Retain Origin Parameters
  • If you enable Retain Origin Parameters, Alibaba Cloud CDN retains all parameters that follow the question mark (?)in request URLs during the back-to-origin routing process.
  • If you do not enable Retain Origin Parameters, only the specified URL parameters are retained during the back-to-origin routing process.

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 of the domain name.
  4. In the management pane of the domain name, click Optimization.
  5. In the Parameter Filtering (Retain Specified Parameters) section, click Modify.
  6. Set the following parameters based on the instructions.
    Retain parameters
    Parameter Description
    Parameter Filtering Turn on Parameter Filtering.
    Retain Specified Parameters Specify the parameters that you want to retain based on your business requirements.
    You can retain at most 10 parameters. Separate parameters with commas (,). For example, for the URL http://www.abc.com/a.jpg?x, set Retain Specified Parameters to x.
    Note If you set only the Retain Specified Parameters parameter, no parameter is retained. You must also turn on Parameter Filtering. You can also turn on Retain Origin Parameters based on business requirements.
    Retain Origin Parameters Turn on or off Retain Origin Parameters based on your business requirements.
    • If you enable Retain Origin Parameters, Alibaba Cloud CDN retains all parameters that follow the question mark (?)in request URLs during the back-to-origin routing process.
    • If you do not enable Retain Origin Parameters, only the specified URL parameters are retained during the back-to-origin routing process.
  7. Click OK.

Related API operations

BatchSetCdnDomainConfig