HTTP headers define the resources being requested, the behavior of the client or server, and the operating parameters of an HTTP transaction. This topic describes how to customize an HTTP response header.

Background information

HTTP headers are components of the header section of request and response messages transmitted over Hypertext Transfer Protocol (HTTP).

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

When you customize HTTP response headers, note the following limits:
  • The HTTP response header configurations of a domain affect how a client program such as a browser responds to all requests destined for this domain. The configurations do not affect the behavior of the cache server.
  • Dynamic Route for CDN (DCDN) supports only the 10 HTTP response headers described in this topic. If you want to specify other HTTP response headers, submit a ticket.
  • You can set the value of the Access-Control-Allow-Origin header to an asterisk (*) to specify all domains or 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 Dynamic Route for CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the target domain name and click Configure.
  4. In the left-side navigation pane of the specified domain, click Caching.
  5. Click the HTTP Header tab.
  6. On the HTTP Header tab, click Add.
  7. In the HTTP Header Setting dialog box that appears, select an HTTP header from the Parameter drop-down list and set its value.
    The following table describes the 10 HTTP response headers provided by DCDN.
    Header name Description Example
    Content-Type Specifies the MIME type of the content returned by a client program. image
    Cache-Control Specifies the caching policy that a client program follows when making responses. no-cache
    Content-Disposition Specifies the default file name provided by a client program when the requested content is saved as a file. 123.txt
    Content-Language Specifies the language of the intended audience for the returned content. en-US
    Expires Specifies the date and time after which the response is considered stale. Wed, 21 Oct 2019 07:28:00 GMT
    Access-Control-Allow-Origin Specifies the origins from which cross-origin requests are allowed. *
    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
    Access-Control-Max-Age Specifies the time-to-live (TTL) value during which the response can be cached for a prefetch request initiated by a 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
    HTTP Header
  8. Click OK.

    To modify or delete the HTTP response header, you can click Modify or Delete in the Actions column on the HTTP Header tab.