Description
This document will introduce you to the common request headers that will be used when using the API. The headers mentioned below will not be reiterated in the specific API documents later.
Request Header List
| Header Name | Description | Type | Required |
|---|---|---|---|
| Authorization | Signature information that carries authentication information and is used to verify the validity of a request. For publicly readable files, this header is not needed. | String | No |
| Content-Length | The HTTP request content length (in bytes) defined in RFC 2616, commonly used for operations of the PUT type API. | String | No |
| Content-Type | The HTTP request content type (MIME) defined in RFC 2616, such as text/plain. | String | No |
| Content-MD5 | Base64-encoded 128-bit content MD5 checksum as defined in RFC 1864. This header is used to verify whether the file content has changed. | String | No |
| Date | GMT time defined in RFC 1123, for example, Wed, 30 Mar. 2016 23:00:00 GMT. | String | No |
| Expect | When using Expect: 100-continue, the request content is sent only after receiving confirmation from the server. This option can be used to validate headers without sending data content. Valid value: 100-continue. |
String | No |
| Host | The host of the request, in the form of .. | String | Yes |
Server-Side Encryption Dedicated Header
For APIs supporting server-side encryption (SSE), the following request headers are applicable based on different encryption methods. Please refer to specific API documents to determine if SSE is applicable. The whether these headers are required only applies to scenarios using SSE. If the request does not support SSE APIs or does not use SSE, these headers do not need to be included. For details, please refer to Server-side Encryption Overview.
SSE-COS
| Header Name | Description | Type | Required |
|---|---|---|---|
| x-cos-server-side-encryption | SSE algorithm, which is set to AES256 when SSE-COS is used. | string | If this header is carried during object upload or copying (including simple upload/copy and multipart upload/copy), SSE-COS is used. If this header is not carried, encryption is performed based on the bucket encryption configuration. This header should not be specified when objects are downloaded. |
SSE-KMS
| Header Name | Description | Type | Required |
|---|---|---|---|
| x-cos-server-side-encryption | SSE algorithm, which is set to cos/kms when SSE-KMS is used. | string | If this header is carried during object upload or copying (including simple upload/copy and multipart upload/copy), SSE-KMS is used. If this header is not carried, encryption is performed based on the bucket encryption configuration. This header should not be specified when objects are downloaded. |
| x-cos-server-side-encryption-cos-kms-key-id | CMK of the KMS when x-cos-server-side-encryption is set to cos/kms. If it is not specified, the CMK created by COS by default is used. For details, see SSE-KMS Encryption. | string | No |
| x-cos-server-side-encryption-context | Encryption context when x-cos-server-side-encryption is set to cos/kms. The value is the Base64-encoded key-value pair of the encryption context in JSON format, for example, eyJhIjoiYXNkZmEiLCJiIjoiMTIzMzIxIn0=. |
string | No |
SSE-C
| Header Name | Description | Type | Required |
|---|---|---|---|
| x-cos-server-side-encryption-customer-algorithm | Server-side encryption algorithm, currently only supports AES256. | string | Yes |
| x-cos-server-side-encryption-customer-key | Base64-encoded SSE key, for example, MDEyMzQ1Njc4OUFCQ0RFRjAxMjM0NTY3ODlBQkNERUY=. |
string | Yes |
| x-cos-server-side-encryption-customer-key-MD5 | Base64-encoded MD5 hash value of the SSE key, for example, U5L61r7jcwdNvT7frmUG8g==. |
string | Yes |