Help Center/ Object Storage Service/ SDK Reference/ C/ Parameters/ Request Parameters for Configuring Static Website Hosting
Updated on 2026-08-03 GMT+08:00

Request Parameters for Configuring Static Website Hosting

Table 1 List of request parameters

Parameter

Type

Mandatory (Yes/No)

Description

options

const obs_options *

Yes

The context of the requested bucket. Refer to Configuring option (SDK for C) to set the AK, SK, endpoint, bucket, timeout, and temporary credentials through obs_options.

set_bucket_redirect_all

obs_set_bucket_redirect_all_conf *

Yes

Indicates the redirection configuration.

set_bucket_redirect_all->host_name

const char *

Yes

Indicates the name of the host where requests will be redirected.

set_bucket_redirect_all->protocol

const char *

No

The HTTP or HTTPS protocol used in redirecting requests. The default protocol is HTTP.

set_bucket_website_conf

obs_set_bucket_website_conf *

Yes

The configuration of the website element in the redirection rules.

set_bucket_website_conf->suffix

const char *

Yes

The suffix that is appended to the requested directory. For example, if the suffix is index.html and samplebucket/images/ is requested, the data that is returned will be the content under the object name images/index.html in the samplebucket bucket.

Restrictions:

The suffix cannot be empty or contain slashes (/).

set_bucket_website_conf->key

const char *

No

Indicates the object name that is used when a 4XX error occurs. This element identifies the page that is returned when an error occurs.

set_bucket_website_conf->routingrule_info

bucket_website_routingrule *

No

Redirection rule description

set_bucket_website_conf->routingrule_count

int

No

Total size of set_bucket_website_conf.routingrule_info

handler

obs_response_handler *

Yes

A callback structure where all members are pointers to callback functions, used to set the callback functions that handle response data. You can set a callback function to copy the response data from the server to your custom callback_data.

callback_data

void *

No

Custom callback data.

The following table describes the redirection rule structure bucket_website_routingrule:

Table 2 bucket_website_routingrule

Parameter

Type

Mandatory (Yes/No)

Description

key_prefix_equals

const char *

Yes

Explanation:

Indicates the object name prefix which the redirection applies to.

For example, to redirect the requests for the object ExamplePage.html, set key_prefix_equals to ExamplePage.html.

Restrictions:

None

Value range:

None

Default value:

None

http_errorcode_returned_equals

const char *

Yes

Explanation:

The HTTP error code for redirection to take effect. If an error code returned is the same as the value specified for this parameter, the redirection rule takes effect.

Examples:

If you want to redirect requests to NotFound.html when an HTTP error code 404 is returned, set http_errorcode_returned_equals to 404 and replace_key_with to NotFound.html.

Restrictions:

None

Value range:

None

Default value:

None

protocol

const char *

Yes

Explanation:

Indicates the protocol (http or https) used for redirecting requests.

Restrictions:

None

Value range:

None

Default value:

None

host_name

const char *

Yes

Explanation:

Indicates the name of the host where requests will be redirected.

Restrictions:

None

Value range:

None

Default value:

None

replace_key_prefix_with

const char *

Yes

Explanation:

The object name prefix used in the redirection. OBS replaces the value of key_prefix_equals with the value of replace_key_prefix_with.

Restrictions:

None

Value range:

None

Default value:

None

replace_key_with

const char *

Yes

Explanation:

The object name prefix used in the redirection. OBS replaces the entire object name in the request with the value of replace_key_with.

Restrictions:

None

Value range:

None

Default value:

None

http_redirect_code

const char *

Yes

Explanation:

Indicates the HTTP status code returned for the redirection request.

Restrictions:

None

Value range:

None

Default value:

None