Mirror back-to-origin
Updated at:2025-11-03
If you configured mirror back-to-origin for the bucket, when you access an object in the bucket that does not exist in BOS, BOS will immediately request the object from the pre-configured back-to-origin address to ensure normal access. During the request process, the data returned by the origin server is automatically delivered to the requesting user without their awareness. Meanwhile, this data will also be automatically stored in BOS, improving the smoothness of such requests in the future. Refer to [Mirror Back-To-Origin](BOS/API Reference/Bucket-Related Interface/Mirror back-to-origin/PutBucketMirroring.md)
Code example
Python
1 mirror_args = list()
2 mirror_args.append({
3 "mode": "fetch",
4 "sourceUrl": "<url>",
5 "backSourceUrl": "<url>",
6 "resource": "*.jpeg",
7 "version": "v2",
8 "passQueryString": False,
9 "storageClass": "STANDARD",
10 })
11 response = bos_client.put_bucket_mirroring(bucket_name, mirror_args=mirror_args)
12 __logger.debug("[Sample] put bucket mirroing response :%s", response)
13 response = bos_client.get_bucket_mirroring(bucket_name)
14 __logger.debug("[Sample] get bucket mirroing response :%s", response)
15 response = bos_client.delete_bucket_mirroring(bucket_name)
16 __logger.debug("[Sample] delete bucket mirroing response :%s", response)
