Problem description
The x-amz-server-side-encryption-aws-kms-key-id form field is not supported in a PostObject request. However, the request contains such form field.
Causes
You initiate a PostObject request that is compatible with Amazon S3 to upload an object and specify the x-amz-server-side-encryption-aws-kms-key-id form field in the request body. However, such form field is not supported in the request body. As a result, a request error is reported.
Examples
The following sample code provides an example of a request body. In this example, the x-amz-server-side-encryption-aws-kms-key-id form field is specified. Such form field is not supported in the request body.
POST / HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 6443500495
Date: Sat, 18 Feb 2023 05:17:02 GMT
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryW0DET1iaBMeAOBg3
Host: example-bucket.oss-cn-hangzhou.aliyuncs.com
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="key"
big.img
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="x-amz-server-side-encryption-aws-kms-key-id"
abc
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="policy"
eyJleHBpcmF0aW9uIjoiMjAyMy0wMi0xOFQxMzoxOTowMC4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF1dfQ==
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="AWSAccessKeyId"
LTAI5tMw****
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="success_action_status"
200
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="signature"
miAoLVohS5*****WEXyC3wVecaQ=
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="file"; filename="big.img"
Content-Type: application/octet-stream
***
------WebKitFormBoundaryW0DET1iaBMeAOBg3--
Solutions
Delete the x-amz-server-side-encryption-aws-kms-key-id form field from the request body.
References
For more information about the PostObject operation, see PostObject.
For more information about how to transfer data from a web client to Object Storage Service (OSS) by using form upload, see Add signatures on the client by using JavaScript and upload data to OSS.
For more information about common errors and troubleshooting methods of the PostObject operation, see PostObject.