All Products
Search
Document Center

Object Storage Service:option-object

Last Updated:Aug 26, 2024

Sends an OPTIONS request.

Usage notes

  • Before a cross-origin request is sent, the browser sends a preflight (OPTIONS) request that includes a specific origin, HTTP method, and header information to Object Storage Service (OSS) to determine whether to send the cross-origin request. The browser automatically determines whether to send the preflight request based on whether the actual request is a cross-origin request.

  • The browser automatically determines whether to send the preflight request based on whether the actual request is a cross-origin request.

Command syntax

ossutil api option-object --bucket value --key value [flags]

Parameter

Type

Description

--access-control-request-headers

string

The custom headers to be sent in the actual cross-origin request.

--access-control-request-method

string

The method to be used in the actual cross-origin request.

--bucket

string

The name of the bucket.

--key

string

The full path of the object.

--origin

string

The origin of the request. It is used to identify a cross-origin request.

Note
  • For more information about supported global command-line options, see Global command-line options.

  • The option-object command corresponds to the Options operation. For more information about the parameters in the Options operation, see Options.

Examples

  • Run the following command to send an OPTIONS request to the example.txt object in the examplebucket bucket:

    ossutil api option-object --bucket examplebucket --key example.txt
  • Run the following command to send an OPTIONS request whose origin is www.example.com to the example.txt object in the examplebucket bucket:

    ossutil api option-object --bucket examplebucket --key example.txt --origin www.example.com
  • Run the following command to send an OPTIONS request which allows PUT requests to the example.txt object in the examplebucket bucket:

    ossutil api option-object --bucket examplebucket --key example.txt --access-control-request-method PUT
  • Run the following command to send an OPTIONS request which contains the x-oss-test1 request header to the example.txt object in the examplebucket bucket:

    ossutil api option-object --bucket examplebucket --key example.txt --access-control-request-headers x-oss-test1