Accessing OBS Using a Temporary URL

You can use a temporary URL to access OBS and perform operations such as creating buckets or objects, and uploading and downloading objects. For details, see Using a URL for Authorized Access. This section describes how to share objects using a temporary URL.

Sharing Objects

You can share objects (files or folders) stored in OBS with all users within a specified period.

Sharing a file

File sharing is temporary. All shared URLs are temporary with a validity period.

A temporary URL consists of the access domain name and the temporary authentication information of a file. Example:

https://bucketname.obs.cn-north-4.myhuaweicloud.com:443/image.png?AccessKeyId=xxx&Expires=xxx&response-content-disposition=xxx&x-obs-security-token=xxx&Signature=xxx

The temporary authentication information contains the AccessKeyId, Expires, x-obs-security-token, and Signature parameters. The AccessKeyId, x-obs-security-token, and Signature parameters are used for authentication. The Expires parameter specifies the validity period of the authentication. For details about the temporary authentication method and parameters, see Authentication of Signature in a URL in Object Storage Service API Reference. A temporary URL also contains the response-content-disposition parameter, which defines whether an object is directly downloaded or previewed in the web browser when it is accessed. The value is determined by the web browser based on the Content-Type of the shared object.

After an object is shared through OBS Console, the system will generate a URL that contains the temporary authentication information, valid for five minutes since its generation by default. Each time when you change the validity period of a URL, OBS obtains the authentication information again to generate a new URL for sharing, which takes effect since the time when the validity period is changed.

Sharing a folder

Folder sharing is temporary and has a validity period. You need to prepare a six-digit extraction code before sharing a folder. After the sharing link of the folder is created, OBS automatically aggregates the download links of all objects in the folder to a static website that is hosted by a public OBS bucket. Then users who have the temporary URL and extraction code can access the static website and download files.

Limitations and Constraints

  • A file or folder shared through OBS Console is valid from one minute to 18 hours. If you need a longer validity period for a shared file or folder, use the client tool OBS Browser+ that allows a validity period of up to one year. If you want users to permanently access the shared file or folder, use a bucket policy to grant anonymous users the public read permissions by referring to Granting Public Read Permissions on Objects to Anonymous Users.
  • Only buckets of version 3.0 support file and folder sharing. You can view the bucket version in the Basic Information area on the Overview page of a bucket.
  • Objects in the Archive storage class can be shared only after being restored. For folder sharing, objects in the Archive storage class can be downloaded only after the original bucket is restored.

Configuration Procedure

For details about how to share files and folders, see Temporarily Sharing Objects with Anonymous Users.