0034-00000102

更新时间:
复制 MD 格式

Problem description

The OPTIONS preflight request is missing the required Access-Control-Request-Method header.

Causes

Before a browser sends a cross-origin request, it first sends a preflight OPTIONS request to OSS to determine whether to send the cross-origin request. This preflight must include both the Origin header and the Access-Control-Request-Method header. If Access-Control-Request-Method is absent, OSS rejects the request with error 0034-00000102.

Examples

The following request triggers this error because Access-Control-Request-Method is missing:

OPTIONS /testobject HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 24 Feb 2012 05:45:34 GMT
Origin: http://www.example.com
Access-Control-Request-Headers: x-oss-test1,x-oss-test2

Solutions

Add Access-Control-Request-Method to the OPTIONS request. This header specifies the HTTP methods the request is allowed to use.

OPTIONS /testobject HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 24 Feb 2012 05:45:34 GMT
Origin: http://www.example.com
Access-Control-Request-Method: PUT
Access-Control-Request-Headers: x-oss-test1,x-oss-test2
Note: Both Origin (the allowed source domain) and Access-Control-Request-Method are required for a valid preflight request.

References