Skip to main content

OptionObject

Description

the browser will send a preflight request (OPTIONS) and bring a specific source domain, HTTP method and header information to OSS to decide whether to send a real request before sending a cross-domain request.

Request Method

POST

Request Path

/apsara/route/OneRouter/OptionObject

Request Parameters Common Parameters

NameLocationTypeRequiredSample valueDescription
OriginBODYstringYeshttp://www.example.comrequest source field, used to mark cross-domain requests. Default value: None
Access-Control-Request-MethodBODYstringYesPUTindicates the method that will be used in the actual request. Default value: None
regionIdBODYstringYesNo sample value for this parameter.region id
Access-Control-Request-HeadersBODYstringYesx-oss-testindicates the header other than the simple header used in the actual request. Default value: None
versionBODYstringNo2016-01-01version of api

Return data

NameTypeSample valueDescription
Access-Control-Expose-HeadersstringContent-Lengthlist of headers allowed to be accessed in the client JavaScript.
Access-Control-Allow-Originstringhttp://www.example.comOrigin included in the request. If the request is not allowed, the response header does not contain the header.
Access-Control-Allow-MethodsstringPUTHTTP methods that allow requests. If the request is not allowed, the response header does not contain the header.
Access-Control-Max-Ageinteger100The time when the browser is allowed to cache preflight results, in seconds.
Access-Control-Allow-Headersstringx-oss-testlist of headers allowed to be carried by the request. If the request contains an unallowed header, the header is not included and the request is rejected.

Example

Successful Response example

{
"Access-Control-Expose-Headers":"Content-Length",
"Access-Control-Allow-Origin":"http://www.example.com",
"Access-Control-Allow-Methods":"PUT",
"Access-Control-Max-Age":"100",
"Access-Control-Allow-Headers":"x-oss-test"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}