All Products
Search
Document Center

Edge Security Acceleration:Configure custom HTTP request headers

Last Updated:Jan 29, 2024

By default, Dynamic Content Delivery Network (DCDN) supports request headers such as client IP addresses. You can also configure custom request headers. Alibaba Cloud allows you to rewrite HTTP headers in back-to-origin requests based on your business requirements.

Background information

HTTP request headers are a component of the header section in requests that are transmitted over HTTP. HTTP request headers include specific parameters that are sent to servers.

When points of presence (POPs) retrieve the requested resources from an origin server, the origin server can obtain information that is included in request headers. Alibaba Cloud CDN allows you to rewrite HTTP headers in back-to-origin requests. The information that is included in request headers is passed to the origin server to meet specific business requirements. For example, you can configure the X-Forwarded-For (XFF) header to pass client IP addresses to your origin server.

For information about how the origin server obtains the IP address of a client from the XFF header in the back-to-origin request, see Retrieve the originating IP addresses of clients.

image

Usage notes

If the value of an HTTP request header is a variable, a specific value is assigned to the variable when the variable is used. The following table describes available variables.

Origin HTTP header

Description

$remote_addr

Adds a header that passes the client IP address to the origin server.

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 whose acceleration region you want to change and click Configure.
  4. In the left-side navigation tree of the domain name, click Origin Fetch.

  5. Click the Custom Request Header tab.

  6. Click Add.

  7. In the Custom HTTP Response Header dialog box, set Parameter and Value.

    配置回源HTTP头

    Parameter

    Example

    Description

    Parameter

    Custom Request Header

    You can select Custom Request Header or a preset header.

    Custom Parameter

    Content-Type

    Set the value to Content-Type.

    Value

    text/html

    You can specify one or more values for an origin header. Separate multiple values with commas (,).

  8. Click OK.