หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Object Storage Service/ API Reference/ APIs/ Advanced Bucket Settings/ Configuring Mirroring Back-to-Source Rules

Configuring Mirroring Back-to-Source Rules

Updated on 2024-04-22 GMT+08:00

Functions

This operation configures mirroring back-to-source rules for a specified bucket. The API is idempotent. If there is already an identical rule for the bucket, a success message is returned with status code 200. Otherwise, status code 201 is returned.

Request Syntax

PUT /?mirrorBackToSource HTTP/1.1
Host: bucketname.obs.region.myhuaweicloud.com 
Authorization: authorization
Content-Type: application/json
Content-Length: length
Date: date

policy json body

Request Parameters

This request contains no message parameters.

Request Headers

This request uses common headers. For details, see Table 3.

Request Elements

Table 1 Request elements

Element

Description

Mandatory

rules

Number of rules.

Type: container

Value range: array size ranging from 1 to 10

NOTE:

For the same bucket, prefixes of different rules cannot contain each other or have duplicate beginning characters. The same agency is recommended.

Yes

Table 2 Rule parameters

Parameter

Description

Mandatory

id

Rule ID. Unique ID of a back-to-source rule configured for the current bucket.

Type: string

Value range: 1 to 256. The value must be within the range of ^[a-zA-Z0-9_-]{1, 256}$.

Yes

condition

Condition for triggering back-to-source.

Type: container

Yes

httpErrorCodeReturnedEquals

Error code that triggers the back-to-source function. When this error is returned for a download request, the back-to-source function is triggered.

Type: integer

Value range: 404

Yes

objectKeyPrefixEquals

Prefix of the object name that triggers the back-to-source function. Back-to-source is performed only when the specified object name prefix is contained in the request. If this parameter is left blank, all objects are matched by default. For the same bucket, prefixes of different rules cannot contain each other or have duplicate beginning characters.

Type: string

Valid value: a string of 0 to 1023 characters

No

redirect

Main parameters of back-to-source.

Type: container

Yes

agency

Agency name With an agency, the customer can grant OBS the permissions to query whether a specified object exists in the bucket and upload objects to the bucket.

Type: string

Yes

publicSource

Configuration of the source site that can be publicly accessed. This parameter is mandatory when the source site is a public accessible resource.

Type: container

No

sourceEndpoint

Source site address that can be publicly accessed.

Type: container

No

master

Primary source address. If the source is a bucket that can be accessed over HTTP network, the address is the bucket domain name. If the source is a private bucket provided by other cloud vendors, the address is a region domain name address.

Type: array

Valid value: A single source site address is in the format of https|http://xxx.yyy.zzz, containing 10 to 255 characters.

NOTE:

The primary source site address is preferentially used during the back-to-source process. If multiple primary addresses are configured, all primary addresses are accessed in polling mode. If two or more primary addresses are configured, when the first request to the primary address fails and the retry conditions are met, the request will retry another primary address.

At least one primary address must be configured.

A maximum of five primary addresses can be configured.

No

slave

Secondary source site address. If the source is a bucket that can be accessed over HTTP network, the address is the bucket domain name. If the source is a private bucket provided by other cloud vendors, the address is a region domain name address.

Type: array

Valid value: A single source site address is in the format of https|http://xxx.yyy.zzz, containing 10 to 255 characters.

NOTE:

A back-to-source request will retry the secondary source site address when primary source site address is not available.

A maximum of five secondary addresses can be configured.

No

retryConditions

Condition for switching the source site address.

Type: array

Value range: 4XX, 5XX, 400-499, and 500-599 error codes

NOTE:

Error codes starting with 4XX and 4 cannot be configured together. Error codes starting with 5XX and 5 cannot be configured together.

A maximum of 20 error codes can be configured.

No

passQueryString

Indicates whether to carry the request character string. If the value is true, the queryString value in the OBS request is passed to the source site. Otherwise, the queryString value will not be passed to the source site.

The default value is false. Value false indicates that the parameter is ignored.

Type: boolean

Value range: false or true

NOTE:

If the value is true but the query contains signature information, delete the signature information and pass the remaining parameters.

Yes

mirrorFollowRedirect

Indicates whether to obtain resources following the 3xx redirection request from the redirected source site. If the value is true, obtain resources following the 3xx redirection request from the redirected source site. Otherwise, OBS transparently passes the 3XX response and does not obtain resources. The default value is false. Value false indicates that the parameter is ignored.

Type: boolean

Value range: false or true

Yes

mirrorHttpHeader

HTTP header pass rule

Type: container

No

passAll

Indicates whether to pass all HTTP headers through the source site.

The following HTTP header types do not support passthrough:

1. Headers starting with the following prefixes:

x-obs-

x-amz-

2. All standard HTTP headers, for example:

Content-Length

Authorization

Date

passAll and pass are mutually exclusive.

Value type: BOOL

Value range: false or true

No

pass

Specifies the list of HTTP headers to be passed through.

Type: list

Value range: a maximum of 10 lists. The length of each list ranges from 1 to 63 characters. The key can contain only letters (both upper and lower cases), digits, hyphens (-), and underscores (_).

No

remove

List of HTTP headers that cannot be passed through.

The remove operation takes precedence over the pass and passAll operations.

Type: list

Value range: a maximum of 10 lists. The length of each list ranges from 1 to 63 characters. The key can contain only letters (both upper and lower cases), digits, hyphens (-), and underscores (_).

No

set

Configuration of list of HTTP headers to be passed through.

The set operation has a higher priority than the remove, pass, and passAll operations.

If the user-defined header contains Referer, redirectWithoutReferer must be set to true. Otherwise, Referer will be overwritten.

Type: list

Value range: a maximum of 10 lists

No

key

Keyword of the HTTP header that needs to be passed through.

Each key is unique.

Type: string

Value range: a string of 1 to 63 characters. Only letters (both upper and lower cases), digits, hyphens (-), and underscores (_) are allowed.

No

value

Value of the HTTP header that needs to be passed through.

Type: string

Value range: a string of 0 to 2048 characters

No

replaceKeyWith

Adds prefix or suffix. If you need to add a prefix or suffix when downloading objects from the source site, set this parameter to prefix${key}suffix. If no prefix or suffix needs to be added, set this parameter to ${key}.

Type: string

Value range: prefix${key}suffix

${key} is the keyword, prefix and suffix are the ones to be added. Total length of the prefix and suffix. The value ranges from 0 to 1023 characters.

No

replaceKeyPrefixWith

Character string used to replace the prefix objectKeyPrefixEquals. If you need to replace the current object name prefix when downloading objects from the source site, modify this configuration item.

If both replaceKeyWith and ReplaceKeyPrefixWith are empty, ReplaceKeyPrefixWith takes effect. The request is invalid if both the parameters are specified.

Type: string

Value range: a string of 0 to 1023 characters

No

vpcEndpointURN

URN of VPC Endpoint service.

Type: string

Value range: a string of 0 to 127 characters

No

redirectWithoutReferer

Indicates whether to carry the original host as the referer header to the destination address for redirection. Value false indicates that the original host will be carried, and true indicates that the original host will not be carried.

Type: boolean

Default value: false

No

mirrorAllowHttpMethod

If HEAD is added for a public bucket, you can use HEAD requests to retrieve objects' metadata, rather than objects, from the origin server.

Type: list

No

Response Syntax

HTTP/1.1 status
Server: OBS
Date: date
Content-Length: length

Response Headers

The response to the request uses common headers. For details, see Table 1.

Response Elements

This response contains no elements.

Error Responses

No special error responses are returned. For details about error responses, see Table 2 and Table 3.

Sample Request

PUT /?mirrorBackToSource HTTP/1.1
Host: bucketname.obs.region.myhuaweicloud.com 
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:sc2PM13Wlfcoc/YZLK0MwsI2Zpo=
Content-Type: application/json
Content-Length: 1049
Date: Tue, 21 Jul 2020 15:38:30 GMT

{
    "rules": [{
        "id": "abc123",
        "condition": {
            "httpErrorCodeReturnedEquals": "404",
            "objectKeyPrefixEquals": "video/"
        },
        "redirect": {
            "agency": "agency",
            "publicSource": {
                "sourceEndpoint": {
                    "master":["http://bucket1.xxx.yyy.com", "https://bucket2.xxx.yyy.com"],
                    "slave": ["http://bucket3.xxx.yyy.com", "https://bucket4.xxx.yyy.com"]
                }
            },
            "retryConditions": ["4XX", "5XX"],
            "passQueryString": true,
            "mirrorFollowRedirect": true,
            "redirectWithoutReferer": true,
            "mirrorAllowHttpMethod":["HEAD"],
            "mirrorHttpHeader": {
                "passAll": false,
                "pass": ["content-encoding"],
                "remove": ["content-type"],
                "set": [{
                    "key": "helloworld",
                    "value": "2222"
                }]
            },
            "replaceKeyWith": "prefix${key}suffix",
            "replaceKeyPrefixWith": "picture/",
            "vpcEndpointURN": "001"
        }
    }]
}

Sample Response

HTTP/1.1 201 Created
Server: OBS
Date: Tue, 07 Jul 2020 07:29:13 GMT
Content-Length: 0

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback