百度智能云

All Product Document

          CDN

          Back-to-origin Configuration

          Back-to-origin Configuration

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin configuration tab in the navbar at the top of the page.
          5. Enter the back-to-origin configuration page and click Edit in the Back-to-source configuration settings module.
          6. The origin domain name is configured as Acceleration domain name, Origin server domain name, or Custom domain name.

          image.png

          1. After clicking Save, you can see that the Back-to-origin configuration setting is successful in the back-to-origin configuration module, and the page prompts "The configuration has been updated successfully and will take effect in about five minutes."

          Back-to-origin 301/302

          Baidu AI Cloud CDN provides you with the origin prefetch 301/302 configuration feature. When the node back-to-origin request returns the 301/302 status code, the CDN node requests resources directly from the redirection address without returning the 301/302 status code to the user.

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin Configuration tab in the navbar at the top of the page.
          5. Enter the back-to-origin configuration page and select On/off of the Back-to-origin 301/302 setting module.

            • Enable back-to-origin 301/302: When a user initiates a request to get resources at address A, if the node receives the 302 status code, the system redirects to the new address B and get resources. After the resource is got, cache it to the node and return it to the user. When other users also initiate a request to the address A resource, the resource is hit at the node and returned to the user.
            • Disable back-to-origin 301/302: When the user initiates a request, and the node receives the 302 status code, the system returns the HTTP Response to the user. When other users also initiate the request to this resource, repeat the steps above.

          Note: After enabling the back-to-origin 301/302 feature, the system can perform redirection 3 times at most. If the limit is exceeded, it directly returns the 301/302 status code to the user.

          Back-to-origin Timeout Configuration

          When the CDN returns to the user's origin server, the TCP connection timeout is 5 seconds by default, and the back-to-origin loading timeout is 10 seconds. In the case of timeout, the back-to-origin failure occurs, and the status code recorded in the CDN log is 504.

          Considerations

          The back-to-origin loading timeout is 10 seconds, which means that there is no data interaction between the CDN and the source server within these 10 seconds. If there is data interaction within 10 seconds, the timeout period is reset. Therefore, in the case of timeout, it is necessary for the user to check the load of the origin server.

          Operation steps

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin configuration tab in the navbar at the top of the page.
          5. Enter the back-to-origin configuration page and click the Edit button in the Back-to-origin timeout configuration module.

          The TCP connection timeout time (whose configuration range is [5, 30]) and back-to-origin loading timeout time (whose configuration range is [5, 60]) can be adjusted according to the origin server's data processing and network conditions to ensure normal back-to-origin.

          1. Click "Save" to complete the back-to-origin configuration.

          Range back-to-origin

          CDN provides customers with a range back-to-origin configuration feature. Range is an Http request header used to request a specified part of a file. E.g., Range: bytes=0-999 means to request the first 1000 bytes of the file. Enabling the Range back-to-origin feature can reduce back-to-origin traffic consumption, efficiently improve the efficiency of large file distribution, and enhance the response speed.

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin configuration tab in the navbar at the top of the page.
          5. Enter the back-to-origin configuration page and select On/off in the Range back-to-origin setting module. This feature requires the origin server to support the range request. Otherwise, it causes back-to-origin failure.
          Range back-to-origin status Example
          Enable If user A requests resources: After the node receives the request and when you need to return to the origin server in the case of missed node cache, cache expiration, and other conditions, the node initiates a back-to-origin request with Range to get resources in fragments, caches the resources, and returns them to the user.
          Close If the user A requests resources: After the node receives the request and when you need to return to the origin server in the case of missed node cache, cache expiration, and other conditions, the node initiates a return request without Range, caches and returns them to the user. At this moment, if there is a range for the request of user A, it may result in the problem of origin amplification and slow response. Origin amplification: For example, when user A requests 7-8 MB resources, the node origin is amplified to the whole resource. Slow response: For example, user A requests 7-8M resources, and the origin node cannot return the body content to the customer until the node gets 0-7M data.

          Back-to-origin Configuration of Private Bucket

          The origin server is BOS, and the bucket is set to private. When CDN acceleration is enabled, users cannot access this bucket resource by accessing the CDN acceleration domain name. If you need to access the private BOS Bucket via CDN, you can enable the "Private Bucket Origin Fetch" feature in the "Origin Fetch Configuration" to authorize the CDN, and then the CDN can return to the private BOS Bucket. This feature enables users to protect the origin server resources and achieve the effect of CDN acceleration.

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin configuration tab in the navbar at the top of the page.
          5. Enter the back-to-origin configuration page and select On/off in the Private bucket back-to-origin setting module.

          Origin Protocol

          You can configure the back-to-origin protocol through this feature and will send it back to port 80 or 443 of your origin server according to the specified protocol (the configuration of the custom port will become invalid).

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin configuration tab in the navbar at the top of the page.
          5. Enter the back-to-origin configuration page and click Edit in the back-to-origin protocol setting module.
          6. Select the back-to-origin protocol. By default, the CDN node uses the HTTP protocol for back-to-origin. :

            • Follow: After selection, the CDN node origin protocol is consistent with the client request protocol;
            • HTTP: After selection, the CDN node forces the origin HTTP protocol to be consistent with the client request protocol;
            • HTTPS: After selection, the CDN node forces the origin HTTPS protocol to be consistent with the client request protocol;

          Note: The prerequisite for the "HTTPS" option is to check that the "HTTPS configuration" of the domain name has been completed and enabled.

          1. After clicking Save, you can see that the Origin protocol is set successfully in the origin protocol module, and it prompts "The configuration has been updated successfully, which takes effect in about five minutes" on the page.

          Get Real User IP

          1. Log in to CDN Management Console to enter the “Content Distribution Network (CDN)” page.
          2. Click Domain name management on the left navbar.
          3. Enter the domain name management page, and click Management in the action column of the target domain name.
          4. Enter the "CDN Domain Name Details" page, and select the Back-to-origin Configuration tab in the navbar at the top of the page.
          5. Go to the back-to-origin configuration page and click Edit in the Get Real User IP Setting Module.
          6. Adjust the "Get Real User IP" to Enabled status, and set the type:

            • Client IP: The origin server can get the client IP address of the access source, which contains True-Client-Ip;
            • Real IP: The origin server can get the client IP address, which contains X-Real-IP.

          image.png

          1. After clicking Save, you can see that the Get Real User IP is enabled in the Get Real User IP module, and there is a prompt "The configuration has been updated successfully, and it will take effect in about five minutes" on the page.
          Previous
          Set HTTPDNS
          Next
          EdgeJS Edge Service