All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Configure mirroring-based back-to-origin

Last updated:2024-03-15 14:07:26

When you send a request to KS3 to access an object that does not exist in KS3, KS3 sends a request to the origin address to retrieve the object if back-to-origin rules are configured, and returns the object to you. For a large object such as an image or a video, KS3 requests part of its data from the origin address and returns it to you, reducing your waiting time. Meanwhile, the object is saved to KS3.

Note:

  1. You can use the mirroring-based back-to-origin service to obtain an object of up to 50 GB in size.

  2. You can configure up to 20 back-to-origin rules.

  3. The data pulled to KS3 is stored in Standard storage by default.

  4. You cannot use the object name setting feature of KS3 to change the names of objects pulled to KS3.

  5. You must contact Kingsoft Cloud business staff or submit a ticket to apply for using the mirroring-based back-to-origin service before you start configuration in the console.

Configure mirroring-based back-to-origin

  1. Log in to the KS3 console and click Bucket in the left navigation pane. On the page that appears, click the name of the target bucket.

  2. Click Bucket Settings. Then, click the Mirror tab. The Mirroring Back-to-Origin tab appears by default.

  3. Click Add Rule. In the Add Rule panel, configure the parameters described in the following table.

Parameter

Required

Description

Prerequisite

Yes

1. HTTP Status Code 404: the default item, which is required.
2. File Name Prefix: optional. The name prefix of the requested object for triggering the back-to-origin rule. For example, if this parameter is set to /abc, the back-to-origin rule is triggered when you access an object with the name prefix /abc, for example, http://bucketname.ks3-endpoint.com/abc/image.jpg).
Note: The object name prefix does not support asterisks (*) and question marks (?) as wildcards. If such wildcards are contained in the prefix, they will be treated as general characters.
You can add only one object name prefix for each rule.

Origin URL

Yes

The source URL for back-to-origin.
First column: Select HTTP or HTTPS based on the access type supported by the origin server.
Second column: Enter the domain name or IP address of the origin server, and configure the port as required.
Third column: Enter the directory where the target object is stored. Multi-level directories must be separated with forward slashes (/). For example, abc/123 indicates the 123 folder in the abc directory. The directory is optional. If it is not specified, the root directory is used by default.
Note: The origin addresses cannot be service domain names of KS3, including:
1. bucektName.endpoint/path.
2. endpoint/bucektName/....
You can add only one origin address for each rule.

Access Control

No

Specifies whether to set the objects automatically and smoothly migrated from the origin server to KS3 to public or private. The objects are private by default.

Other Parameter

No

Specifies whether to transmit the query string in the request that is sent to KS3 to the origin server. The query string is not passed through to the origin server by default.

3xx Response

No

Specifies whether to follow the origin server to redirect requests based on the 3XX status code to obtain resources and save the resources to KS3. The default value is Yes. If you set this parameter to No, KS3 passes through the 3XX response to the client without following the 3XX address.
HTTP 3XX status codes include 301 and 302.

Set Transmission Rule of HTTP Header

No

Specifies whether to transmit HTTP headers to the origin server. No HTTP header is transmitted to the origin server by default. You can configure transmission rules for HTTP headers to customize transmission actions such as passthrough, filtering, or modification.
1. Allow: You can transmit all HTTP headers or specified HTTP headers (up to 10).
2. Deny: You can select Prohibit Transmission of Specified HTTP Header and enter up to 10 HTTP headers that are to be filtered out.
3. Set up: You can select Configure Specified HTTP Header and enter up to 10 HTTP headers that are to be modified.

Example of setting an HTTP header transmission rule: Allow: Select Transmit Specified HTTP Header and enter response-content-type. Deny: Select Prohibit Transmission of Specified HTTP Header and enter If-Modified-Since. Set up: Set the specified HTTP header c-header to 111.

Based on the preceding configurations, assume that the request you send to KS3 contains the following HTTP headers:

GET /object
host : bucketname. ks3-cn-beijing.ksyuncs.com
response-content-type :String
If-Modified-Since : Fri, 26 Dec 2014 06:48:46 GMT
c-header : ccc

After mirroring-based back-to-origin is triggered, the request that KS3 sends to the origin server contains the following headers:

GET /object
host : source.com
response-content-type :String
c-header : 111 

Note:

You cannot configure transmission rules for the following HTTP headers:

Headers starting with the following prefixes:

  • x-kss-

  • x-ks3-

All standard HTTP headers, for example:

  • content-length

  • authorization2

  • authorization

  • range

  • date

The rule priority is as follows: Set up > Deny > Allow. For example, assume that the following three rules are configured for the x-age header: allow x-age to be transmitted to the origin server, prohibit x-age from being transmitted to the origin server, and set x-age to 1. In this case, the x-age header with a value of 1 is transmitted to the origin server.

  1. Click OK.

Edit mirroring-based back-to-origin rules

  1. Log in to the KS3 console and click Bucket in the left navigation pane. On the Bucket list page, click the name of the target bucket.

  2. Click Bucket Settings. Then, click the Mirror tab. The Mirroring Back-to-Origin tab appears by default.

  3. Find the back-to-origin rule that you want to edit and click Edit in the Action column.

  4. In the panel that appears, edit the rule.

Delete mirroring-based back-to-origin rules

  1. Log in to the KS3 console and click Bucket in the left navigation pane. On the Bucket list page, click the name of the target bucket.

  2. Click Bucket Settings. Then, click the Mirror tab. The Mirroring Back-to-Origin tab appears by default.

  3. Find the back-to-origin rule that you want to delete and click Delete in the Action column.

  4. In the message that appears, click OK.

Adjust the sequence of back-to-origin rules

You can move up or down the back-to-origin rules to adjust their sequence. KS3 determines the matching priority of the rules based on their sequence. If Rule 1 is matched, Rule 2 will not be matched. However, if the origin server in Rule 1 is unavailable, KS3 will send a request to the standby origin server in Rule 2. You can configure up to 20 rules. Therefore, a maximum of 19 standby origin servers are available.

  1. Log in to the KS3 console and click Bucket in the left navigation pane. On the Bucket list page, click the name of the target bucket.

  2. Click Bucket Settings. Then, click the Mirror tab. The Mirroring Back-to-Origin tab appears by default.

  3. Find the target back-to-origin rule and click Move Up or Move Down in the Action column.

Example of matching multiple rules:

Assume that multiple rules with the same or partially overlapping back-to-origin conditions are configured:

Rule 1: Access test.com when the 404 error is returned for all objects.

Rule 2: Access 141.0.0.12 when the 404 error is returned for all objects.

Rule 3: Access back.com when the 404 error is returned for objects with the name prefix 333.

Processing of KS3:

  1. KS3 matches the request against Rule 1. If data can be properly pulled from test.com, KS3 no longer matches the request against Rule 2.

  2. KS3 matches the request against Rule 1. However, test.com is unavailable when the back-to-origin service of KS3 attempts to access it. Then, KS3 attempts to access 141.0.0.12 configured in Rule 2.

  3. If 141.0.0.12 configured in Rule 2 is also unavailable and the object name prefix is 333, KS3 continues to access back.com in Rule 3. If the object name prefix is not 333, KS3 returns the 404 error to you.

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback