Customizes the response data and headers for a GetObject request processed through Function Compute.
Prerequisites
Grant the oss:WriteGetObjectResponse permission to the default role (AliyunFCDefaultRole) of your Function Compute service. Sample policy:
{
"Statement": [
{
"Action": "oss:WriteGetObjectResponse",
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "1"
}
Request headers
POST /?x-oss-write-get-object-response HTTP/1.1
Host: RouteFromFcEvent
Date: GMT Date
Authorization: SignatureValue
x-oss-request-route: RouteFromFcEvent
x-oss-request-token: TokenFromFcEvent
x-oss-fwd-status: StatusCode
x-oss-fwd-header-Accept-Ranges: AcceptRanges
x-oss-fwd-header-Cache-Control: CacheControl
x-oss-fwd-header-Content-Disposition: ContentDisposition
x-oss-fwd-header-Content-Encoding: ContentEncoding
x-oss-fwd-header-Content-Language: ContentLanguage
Content-Length: ContentLength
x-oss-fwd-header-Content-Range: ContentRange
x-oss-fwd-header-Content-Type: ContentType
x-oss-fwd-header-ETag: ETag
x-oss-fwd-header-Expires: Expires
x-oss-fwd-header-Last-Modified: LastModified
Request header parameters
|
Header |
Type |
Required |
Example |
Description |
|
Host |
String |
Yes |
****-opap.oss-cn-qingdao-internal.oss-object-process.aliyuncs.com |
Route address from the Function Compute event parameter. |
|
Date |
String |
Yes |
Tue, 31 Oct 2023 03:17:58 GMT |
Request initiation time in HTTP 1.1 GMT format. |
|
Authorization |
String |
Yes |
OSS lkojgn8y1exic6e:6****+BuuEqzI1tAMW0wgIyl**** |
Authenticates the request. Calculate this value as described in Include signatures in the Authorization header. |
|
x-oss-request-route |
String |
Yes |
****-opap.oss-cn-qingdao-internal.oss-object-process.aliyuncs.com |
Route address from the Function Compute event parameter. |
|
x-oss-request-token |
String |
Yes |
OSSV1#ZvBDC3XPm3g**** |
Forwarding token from the Function Compute event parameter. |
|
x-oss-fwd-status |
String |
Yes |
200 |
HTTP status code from the backend server. Valid values: 200, 206, 301, 302, 303, 304, 400, 401, 403, 404, 405, 409, 411, 412, 416, 500, and 503. |
|
x-oss-fwd-header-Accept-Ranges |
String |
No |
bytes |
Specifies the queryable resource range. |
|
x-oss-fwd-header-Cache-Control |
String |
No |
no-cache |
Specifies client caching behavior. Valid values:
|
|
x-oss-fwd-header-Content-Disposition |
String |
No |
attachment |
Controls download behavior. Valid values:
|
|
x-oss-fwd-header-Content-Encoding |
String |
No |
gzip |
Specifies the content encoding. Valid values:
|
|
x-oss-fwd-header-Content-Language |
String |
No |
en |
Specifies the content language. |
|
Content-Length |
String |
Yes |
67589 |
Size of the HTTP message body in bytes. |
|
x-oss-fwd-header-Content-Range |
String |
No |
bytes 0-9/67589 |
Specifies the byte range of the returned content. For example, |
|
x-oss-fwd-header-Content-Type |
String |
No |
text/html; charset=utf-8 |
Specifies the MIME type of the response body. |
|
x-oss-fwd-header-ETag |
String |
No |
D41D8CD98F00B204E9800998ECF8**** |
Entity tag that uniquely identifies the object. |
|
x-oss-fwd-header-Expires |
String |
No |
Fri, 10 Nov 2023 03:17:58 GMT |
Absolute expiration time of the cached content. |
|
x-oss-fwd-header-Last-Modified |
String |
No |
Tue, 10 Oct 2023 03:17:58 GMT |
Last modification time of the requested resource. |
Response headers
WriteGetObjectResponse returns only Common HTTP headers.
Examples
-
Sample request
POST /?x-oss-write-get-object-response HTTP/1.1 Host: RouteFromFcEvent Date: Tue, 31 Oct 2023 03:17:58 GMT Authorization: SignatureValue x-oss-request-route: RouteFromFcEvent x-oss-request-token: TokenFromFcEvent x-oss-fwd-status: 200 x-oss-fwd-header-Accept-Ranges: bytes x-oss-fwd-header-Cache-Control: no-cache x-oss-fwd-header-Content-Disposition: attachment x-oss-fwd-header-Content-Encoding: gzip x-oss-fwd-header-Content-Language: en Content-Length: 67589 x-oss-fwd-header-Content-Range: bytes 0-9/67589 x-oss-fwd-header-Content-Type: text/html; charset=utf-8 x-oss-fwd-header-ETag: D41D8CD98F00B204E9800998ECF8**** x-oss-fwd-header-Expires: Fri, 10 Nov 2023 03:17:58 GMT x-oss-fwd-header-Last-Modified: Tue, 10 Oct 2023 03:17:58 GMT -
Sample response
HTTP/1.1 200 OK x-oss-request-id: 6540CF0DCB24453133A**** Date: Tue, 31 Oct 2023 03:17:58 GMT Content-Length: 0