HTTP headers define the resources that are being requested, the behaviors of clients or servers, and the operation parameters of HTTP requests. This topic describes how to customize an HTTP response header.

Background information

HTTP headers are the components of header sections in request and response messages that are transferred over HTTP.

HTTP headers include general headers, request headers, and response headers.

When you create an HTTP response header, pay attention to the following notes:
  • The configurations of the HTTP response header for an accelerated domain name affect how a client program responds to all the requests that are destined for the domain. The client program can be a browser. The header configurations do not affect the cache server.
  • You can set the value of Access-Control-Allow-Origin to an asterisk (*) to specify all the domain names. You can also set the value to a specific domain name, such as www.aliyun.com.
  • DCDN does not support configuring response headers for wildcard domains.

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, click Caching.
  5. On the HTTP Header tab, click Add.
  6. In the HTTP Header Setting dialog box, select an HTTP header from the Parameter drop-down list and specify the Value parameter.
    Customize an HTTP header
    The following table describes the 10 HTTP response headers that are provided by Dynamic Route for CDN (DCDN). If you need to specify other HTTP response headers,submit a ticket.
    Parameter Description Example
    Content-Type Specifies the type of the content that is returned to the client program. image
    Cache-Control Specifies the cache policy that the client program follows for requests and responses. no-cache
    Content-Disposition Specifies the default file name that is provided by the client program when the requested content is saved as a file. 123.txt
    Content-Language Specifies the language of the intended audience for the content that is returned to the client program. zh-CN
    Expires Specifies the expiration time of the content that is returned to the client program. Wed, 21 Oct 2015 07:28:00 GMT
    Access-Control-Allow-Origin Specifies the origins from which cross-origin requests are allowed. *
    Note You can enter * in the Value field to specify all the domain names. You can also enter a full domain name, such as www.aliyun.com.
    Access-Control-Allow-Headers Specifies the fields that are allowed in cross-origin requests. X-Custom-Header
    Access-Control-Allow-Methods Specifies the request methods that are allowed for cross-origin requests. POST, GET
    Note To add the POST method and the GET method, separate them with a comma (,).
    Access-Control-Max-Age Specifies the time to live (TTL) during which the response can be cached for a preflight request that is initiated by the client program for a particular resource. 600
    Access-Control-Expose-Headers Specifies the headers that can be exposed as part of the response. Content-Length
  7. Click OK.

    On the HTTP Header page, you can click Modify or Delete to manage the HTTP header.