tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

GET Bucket website

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2025-12-15 10:15:16

Overview

This API is used to query the configuration of static websites associated with a bucket.


Request

Sample request

GET /?website HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Note:
In Host: <BucketName-APPID>.cos.<Region>.myqcloud.com, <BucketName-APPID> is the bucket name followed by the APPID, such as examplebucket-1250000000 (see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).
Authorization: Auth String (See Request Signature for details.)

Request parameters

This API has no request parameter.

Request headers

This API only uses Common Request Headers.

Request body

This API does not have a request body.

Response

Response headers

This API only returns Common Response Headers.

Response body

A successful query will return application/xml data that includes all information about the static website configuration of the bucket.
<WebsiteConfiguration>
<IndexDocument>
<Suffix>string</Suffix>
</IndexDocument>
<RedirectAllRequestsTo>
<Protocol>string</Protocol>
</RedirectAllRequestsTo>
<ErrorDocument>
<Key>string</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>integer</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>string</Protocol>
<ReplaceKeyWith>string</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>string</KeyPrefixEquals>
</Condition>
<Redirect>
<Protocol>string</Protocol>
<ReplaceKeyPrefixWith>string</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
The nodes are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
WebsiteConfiguration
None
Stores the result of GET Bucket website.
Container
Content of WebsiteConfiguration:
Node Name (Keyword)
Parent Node
Description
Type
IndexDocument
WebsiteConfiguration
Index document configuration
Container
RedirectAllRequestsTo
WebsiteConfiguration
Redirection configuration for all requests
Container
ErrorDocument
WebsiteConfiguration
Error document configuration
Container
RoutingRules
WebsiteConfiguration
Routing rule configuration
Container
Content of IndexDocument:
Node Name (Keyword)
Parent Node
Description
Type
Suffix
WebsiteConfiguration.IndexDocument
The object key suffix of index documents. For example, if this parameter is set to index.html, index.html will be automatically returned when you access the root directory of the bucket, and article/index.html will be returned when you access the article/ directory.
string
Content of RedirectAllRequestsTo:
Node Name (Keyword)
Parent Node
Description
Type
Protocol
WebsiteConfiguration.RedirectAllRequestsTo
The target protocol to redirect all requests
string
Content of ErrorDocument:
Node Name (Keyword)
Parent Node
Description
Type
Key
WebsiteConfiguration.ErrorDocument
Object key of the general error document
string
Content of RoutingRules:
Node Name (Keyword)
Parent Node
Description
Type
RoutingRule
WebsiteConfiguration.RoutingRules
A single routing rule
Container
Content of RoutingRules.RoutingRule:
Node Name (Keyword)
Parent Node
Description
Type
Condition
WebsiteConfiguration.RoutingRules.RoutingRule
Condition for the routing rule
Container
Redirect
WebsiteConfiguration.RoutingRules.RoutingRule
Configuration of the redirection target
Container
Content of RoutingRules.RoutingRule.Condition:
Node Name (Keyword)
Parent Node
Description
Type
HttpErrorCodeReturnedEquals
WebsiteConfiguration.RoutingRules.RoutingRule.Condition
The error code to match the routing rule
integer
KeyPrefixEquals
WebsiteConfiguration.RoutingRules.RoutingRule.Condition
The object key prefix to match the routing rule
string
Content of RoutingRules.RoutingRule.Redirect:
Node Name (Keyword)
Parent Node
Description
Type
Protocol
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Target protocol for the routing rule
string
ReplaceKeyWith
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Target object key to replace the original object key in the request
string
ReplaceKeyPrefixWith
WebsiteConfiguration.RoutingRules.RoutingRule.Redirect
Target object key prefix to replace the original object key prefix that is matched in the request
string

Error codes

This API returns common error responses and error codes. For more information, please see Error Codes.

Sample

Request

GET /?website HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed, 20 May 2020 09:33:49 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKID8A0fBVtYFrNm02oY1g1JQQF0c3JO****&q-sign-time=1589967229;1589974429&q-key-time=1589967229;1589974429&q-header-list=date;host&q-url-param-list=website&q-signature=50a22a30b02b59e5da4a0820d15a36805ea7****
Connection: close

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 1163
Connection: close
Date: Wed, 20 May 2020 09:33:49 GMT
Server: tencent-cos
x-cos-request-id: NWVjNGY5N2RfYTdjMjJhMDlfNjZkY18yYWUx****

<WebsiteConfiguration>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<RedirectAllRequestsTo>
<Protocol>https</Protocol>
</RedirectAllRequestsTo>
<ErrorDocument>
<Key>pages/error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<ReplaceKeyWith>pages/403.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>pages/404.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>assets/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>index.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>article/</KeyPrefixEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<ReplaceKeyPrefixWith>archived/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>


Ajuda e Suporte

Esta página foi útil?

comentários