Help Center/ Object Storage Service/ User Guide/ Data Management/ Using Mirroring-Based Back to Source to Retrieve Data
Updated on 2025-08-04 GMT+08:00

Using Mirroring-Based Back to Source to Retrieve Data

Usually, if the data requested by a client using GET is not found in OBS, a 404 error will be returned. To avoid this error, OBS provides back to source that pulls the requested data from the source site (origin server) if it is not found in OBS.

Process of Back to Source by Mirroring

If the data you requested is not found in a bucket that has a back-to-source by mirroring rule configured and the request matches the rule, OBS will pull the data from its origin server and return it to you. This process does not interrupt services. Therefore, you can use this function to seamlessly migrate data from the origin server to OBS without being sensed by users, at low costs. Figure 1 shows the process of back to source by mirroring.

Figure 1 Process of back to source by mirroring

You can further configure a redirection address according to the settings of back to source by mirroring. If OBS fails to obtain resources from the origin server and the redirection rule is matched, OBS will return a 302 status code and a redirection address to the client. The client can directly request resources from the redirection address. Figure 2 shows the redirection process.

Figure 2 Process of redirecting a request

Back-to-Source Rules

Item

Description

Conditions for triggering an origin pull rule

OBS pulls data from the origin server only when a GetObject request results in a 404 response.

Rules for naming the retrieved files

If OBS retrieves a file from the origin server via http(s)://MirrorURL/ObjectName, the file is stored in OBS under the same name, ObjectName. For example, if the source address set for a bucket is https://yun.com and the requested file example.jpg is not found in the bucket, OBS will retrieve the file via https://yun.com/example.jpg and file example.jpg is then pushed to OBS.

Status code return rules in the case of retrieval failures

If OBS fails to retrieve a file from the source, it returns 404 to the client by default.

Rules for updating the retrieved files

If a file has been pushed by the origin server to OBS through mirroring, OBS does not update the file even if the source file changes.

HTTP request rules

By default, headers and query strings included in requests to OBS are not transferred to the origin server. However, you can configure the back to source settings to specify whether they should be passed along.

Constraints

Table 1 Back to source constraints

Category

Description

Bucket versions

Only buckets of version 3.0 or later support back to source by mirroring.

Time

It takes about five minutes to apply any changes to a back-to-source by mirroring rule.

Regions

For the regions that support back to source, see Function Overview.

Number of rules

A maximum of 10 back-to-source by mirroring rules can be configured for a bucket.

Functions

  • Parallel file systems do not support back-to-source by mirroring rules.
  • Static website hosting does not support back to source by mirroring. Specifically, if 404 is returned when you use a static website domain name to download an object, back to source by mirroring will not be triggered.
  • A bucket cannot mirror itself.
  • Currently, back to source by mirroring from private buckets is only supported for some cloud vendors.
  • Transfer-Encoding: chunked cannot be used for the origin server to transmit data, or the origin pull will fail. The response to the request for downloading an object from the origin server must contain the Content-Length header to specify the size of the source object. To achieve this, in the Create/Edit Back-to-Source Rule window, choose Pass all parameters for HTTP Header Pass Rule, enable Do not pass specified parameters, and add Accept-Encoding.
  • If NGINX was deployed as a reverse proxy for your origin server, turn off chunked_transfer_encoding of the NGINX.
    location / {
         chunked_transfer_encoding off;
    }

Permissions

  • To configure, obtain, or delete back-to-source by mirroring rules, you must have the Tenant Administrator permission assigned by using IAM.
  • You must create a cloud service agency using IAM to delegate OBS to pull data from the origin server. The agency must include the obs:object:PutObject, obs:object:GetObject, obs:bucket:ListBucket, and obs:object:AbortMultipartUpload permissions.
  • If SSE-KMS is enabled for a bucket, the kms:cmk:get, kms:cmk:list, kms:cmk:create, kms:dek:create, and kms:dek:crypto permissions must be configured for the IAM agency for OBS.

Others

  • Back to source by mirroring is free now.
  • An object cannot match two different back-to-source by mirroring rules.
Figure 3 Configuration method

Creating a Back-to-Source by Mirroring Rule

You can use OBS Console or APIs to create a mirroring back-to-source rule.

References