OPTIONS /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateOrigin: OriginAccess-Control-Request-Method: RequestMethod
OPTIONS / HTTP/1.1
或者 OPTIONS /?lifecycle HTTP/1.1
等。名称 | 描述 | 类型 | 是否必选 |
Origin | 发起 CORS 请求的域名。 | string | 是 |
Access-Control-Request-Method | 发起 CORS 请求所用的方法(Method) | string | 是 |
Access-Control-Request-Headers | 发起 CORS 请求时使用的 HTTP 请求头部,不区分英文大小写,可使用英文逗号(,)分隔多个头部 | string | 否 |
名称 | 描述 | 类型 |
Access-Control-Allow-Origin | 允许发起 CORS 的域名,可能的值有以下两种: * :代表允许所有域名请求头 Origin 中指定的域名:代表允许指定域名 | string |
Access-Control-Allow-Methods | 允许发起 CORS 请求所使用的方法(Method),可使用英文逗号(,)分隔多个方法 | string |
Access-Control-Expose-Headers | 允许浏览器获取的 CORS 请求中的 HTTP 响应头部,不区分英文大小写,可使用英文逗号(,)分隔多个头部 | string |
Access-Control-Max-Age | CORS 配置的有效时间,单位为秒,在有效时间内,浏览器无须为同一请求再次发起预检请求 | integer |
OPTIONS /exampleobject HTTP/1.1Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.comDate: Thu, 09 Jul 2020 14:49:22 GMTOrigin: https://example.comAccess-Control-Request-Method: PUTAccess-Control-Request-Headers: content-md5,content-type,x-cos-meta-authorConnection: close
HTTP/1.1 200 OKContent-Length: 0Connection: closeAccess-Control-Allow-Credentials: trueAccess-Control-Allow-Headers: content-md5,content-type,x-cos-meta-authorAccess-Control-Allow-Methods: PUT,GET,POST,DELETE,HEADAccess-Control-Allow-Origin: https://example.comAccess-Control-Expose-Headers: Content-Length,ETag,x-cos-meta-authorAccess-Control-Max-Age: 600Date: Thu, 09 Jul 2020 14:49:22 GMTServer: tencent-cosx-cos-request-id: NWYwNzJlNzJfODRjOTJhMDlfMjU0MWNfMTNmZDM5****
OPTIONS /exampleobject HTTP/1.1Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.comDate: Thu, 09 Jul 2020 14:49:22 GMTOrigin: https://example.comAccess-Control-Request-Method: GETAccess-Control-Request-Headers: rangeConnection: close
HTTP/1.1 200 OKContent-Length: 0Connection: closeAccess-Control-Allow-Headers: range,x-cos-server-side-encryption-customer-algorithm,x-cos-server-side-encryption-customer-key,x-cos-server-side-encryption-customer-key-md5Access-Control-Allow-Methods: GET,HEADAccess-Control-Allow-Origin: *Access-Control-Expose-Headers: Content-Length,ETag,x-cos-meta-authorAccess-Control-Max-Age: 600Date: Thu, 09 Jul 2020 14:49:22 GMTServer: tencent-cosx-cos-request-id: NWYwNzJlNzJfZDUyNzVkNjRfYTA2Ml8yNGEz****
OPTIONS /?lifecycle HTTP/1.1Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.comDate: Thu, 09 Jul 2020 14:29:40 GMTOrigin: https://bar.comAccess-Control-Request-Method: PUTAccess-Control-Request-Headers: content-md5,content-typeConnection: close
HTTP/1.1 200 OKContent-Length: 0Connection: closeAccess-Control-Allow-Credentials: trueAccess-Control-Allow-Headers: content-md5,content-typeAccess-Control-Allow-Methods: PUT,GET,POST,DELETE,HEADAccess-Control-Allow-Origin: https://bar.comAccess-Control-Expose-Headers: Content-Length,ETag,x-cos-meta-authorAccess-Control-Max-Age: 600Date: Thu, 09 Jul 2020 14:29:40 GMTServer: tencent-cosx-cos-request-id: NWYwNzI5ZDRfNjFiMDJhMDlfYzk2NF8xYmZl****
OPTIONS /exampleobject HTTP/1.1Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.comDate: Thu, 09 Jul 2020 11:45:26 GMTOrigin: https://example.comAccess-Control-Request-Method: PUTConnection: close
HTTP/1.1 403 ForbiddenContent-Type: application/xmlContent-Length: 687Connection: closeDate: Thu, 09 Jul 2020 11:45:26 GMTServer: tencent-cosx-cos-request-id: NWYwNzAzNTZfNzNjODJhMDlfMzRiM2ZfMThjMjk4****x-cos-trace-id: OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OWE4OGMxZjNjY2JiNTBmMTVmMWY1MzAzYzkyZGQ2ZWM4OWM4Y2M5MzI5ZmUzN2FjZDk1OTRjYWI5Yjg5OTJlZDA=<?xml version='1.0' encoding='utf-8' ?><Error><Code>AccessForbidden</Code><Message>CORSResponse: This CORS request is not allowed. This is usually because the evalution of Origin, request method / Access-Control-Request-Method or Access-Control-Requet-Headers are not whitelisted by the resource's CORS spec</Message><Resource>examplebucket-1250000000.cos.ap-beijing.myqcloud.com/exampleobject</Resource><RequestId>NWYwNzAzNTZfNzNjODJhMDlfMzRiM2ZfMThjMjk4****</RequestId><TraceId>OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OWE4OGMxZjNjY2JiNTBmMTVmMWY1MzAzYzkyZGQ2ZWM4OWM4Y2M5MzI5ZmUzN2FjZDk1OTRjYWI5Yjg5OTJlZDA=</TraceId></Error>
本页内容是否解决了您的问题?