After you enable the parameter filtering feature, Alibaba Cloud Dynamic Route for CDN (DCDN) can delete parameters that are specified after the question mark (?) in the request URLs. This improves the cache hit ratio, reduces the number of requests that are redirected to the origin server, reduces the costs of back-to-origin data transfer, and accelerates content delivery. This topic describes how to configure the parameter filtering feature.

Background information

  • Enable the parameter filtering feature

    For example, DCDN receives a request in which the URL contains a question mark (?) after which parameters are specified: http://alibaba.com/content?a. If a low priority is assigned to the parameters and content can be retrieved even if the parameters are not used, we recommend that you enable the parameter filtering feature. You can enable the feature to delete parameters that are specified after the question mark (?) in the request URLs to increase the cache hit ratio.

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

  • Disable the parameter filtering feature

    For example, DCDN receives a request in which the URL contains a question mark (?) after which parameters are specified. If the parameters specify important information, we recommend that you disable the parameter filtering feature. After the feature is disabled, DCDN checks the entire URL, including the parameters that are specified after the question mark (?). Exact matches increase the accuracy of content retrieval.

    For example, the first time you visit http://www.****.com/1.jpg, the requested resource is not cached on DCDN nodes. DCDN must retrieve the requested resource from the origin server. When you visit http://www****.com/1.jpg?test1, the parameters that are specified after the question mark (?) are retained because parameter filtering is disabled. DCDN checks the entire URL. The request cannot hit the cached resource because the request URL is different from http://www.****.com/1.jpg. The request is redirected to the origin server to retrieve the resource of http://www.****.com/1.jpg?test1.

Note The URL authentication feature takes priority over the parameter filtering feature. The signature information of authentication type A contains the parameters of an HTTP request. DCDN nodes must verify the signature of the request URL before the DCDN nodes cache a version of the requested resource. For more information about how to configure URL authentication, see Configure URL signing.

Procedure

  1. Log on to the DCDN 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 Configure in the Actions column.
  4. In the left-side navigation pane on the details page of the specified domain name, click Optimization.
  5. In the Parameter Filtering section, click Modify. The following figure shows how to configure parameter filtering. Configure the parameter filtering feature
    Note If you change the filter mode, the existing configuration is cleared.

    You can select Retain Specified Parameters or Delete Specified Parameters for Filter Mode. The following table describes the parameters.

    Filter mode Parameter Description
    Retain Specified Parameters Parameter Filtering
    • Yes: DCDN deletes the parameters that are specified after the question mark (?) in request URLs. This increases the cache hit ratio.
      Note If you enable Parameter Filtering and do not specify parameters in Retain Specified Parameters, all parameters that are specified after the question mark (?) are deleted.
    • No: The parameters that are specified after the question mark (?) in a request URL must match the parameters specified in the cached version. Exact matches increase the accuracy of content retrieval.
    Retain Specified Parameters Specifies the parameters that you want to retain. You can specify up to 10 parameters. Separate multiple parameters with commas (,).
    Note If you specify only Retain Specified Parameters, the parameter filtering setting does not take effect. This parameter must be specified together with Parameter Filtering and Retain Parameters in Back-to-origin Parameters.
    Examples:
    • Example 1: Only Parameter Filtering is enabled. Retain Parameters in Back-to-origin Parameters is disabled.

      Original URL: http://example.com/test.png?key1=123&key2=321

      Cached key: http://example.com/test.png

      Back-to-origin URL: http://example.com/test.png

    • Example 2: Parameter Filtering is enabled, and key1 is specified in Retain Specified Parameters.

      Original URL: http://example.com/test.png?key1=123&key2=321

      Cached key: http://example.com/test.png?key1=123

      Back-to-origin URL: http://example.com/test.png?key1=123

    • Example 3: Parameter Filtering and Retain Parameters in Back-to-origin Parameters are enabled.

      Original URL: http://example.com/test.png?key1=123&key2=321

      Cached key: http://example.com/test.png

      Back-to-origin URL: http://example.com/test.png?key1=123&key2=321

    • Example 4: Parameter Filtering and Retain Parameters in Back-to-origin Parameters are enabled. key1 is specified in Retain Specified Parameters.

      Original URL: http://example.com/test.png?key1=123&key2=321

      Cached key: http://example.com/test.png?key1=123

      Back-to-origin URL: http://example.com/test.png?key1=123&key2=321

    Retain Parameters in Back-to-origin Parameters
    • Yes: DCDN retains all parameters in a request URL during the back-to-origin process.
    • No: DCDN retains only the specified parameters in a request URL during the back-to-origin process.
    Delete Specified Parameters Delete Specified Parameters

    Specifies the parameters that you want to delete. You can specify up to 10 parameters. Separate multiple parameters with space characters.

    Example: key1 is specified in Delete Specified Parameters and Retain Parameters in Back-to-origin Parameters is enabled.

    Original URL: http://example.com/test.png?key1=123&key2=321

    Cached key: http://example.com/test.png?key2=321

    Back-to-origin URL: http://example.com/test.png?key1=123&key2=321

    Retain Parameters in Back-to-origin Parameters
    • Yes: DCDN retains all parameters in a request URL during the back-to-origin process.
    • No: DCDN deletes the specified parameters from a request URL during the back-to-origin process.
  6. Click OK.