Unlock the Power of AI

1 million free tokens

88% Price Reduction

Activate Now

How do I handle the "SecondLevelDomainForbidden" error reported when I requested OSS resources?

Updated at: 2023-02-27 06:34

Problem description

The "SecondLevelDomainForbidden" error was returned for a resource request to Object Storage Service (OSS). The following content shows the error details:

  • Error message 1: The bucket you are attempting to access must be addressed using OSS third level domain.

  • Error message 2: Please use virtual hosted style to access.

Causes

  • Cause of error message 1: The domain name in the request is not a third-level domain.

  • Cause of error message 2: A host error occurs.

Solutions

Modify your request based on the returned error message:

  • Error message 1: Include third-level domains that contain information about buckets in all requests except the requests that you send to perform the GetService (ListBuckets) operation. The domain name used to access a bucket is in the BucketName.Endpoint format. BucketName indicates the name of the bucket and Endpoint indicates the endpoint of the region in which the bucket is located. An example of a valid OSS domain name is https://examplebucket.oss-cn-hangzhou.aliyuncs.com.

  • Error message 2: When you access OSS over the Internet, use the URL of the object that you want to access to specify the object. For more information, see OSS domain names. The URL of an OSS object is in the [$Schema]://[$Bucket].[$Endpoint]/[$Object] format. For example, if you want to access an object named example.txt in the destfolder directory of the bucket named examplebucket in the China (Hangzhou) region, you can use the following URL: https://examplebucket.oss-cn-hangzhou.aliyuncs.com/destfolder/example.txt.

    Note
    • [$Schema] is the schema of the URL. Valid values: HTTP and HTTPS.

    • [$Bucket] is the name of the bucket.

    • [$Endpoint] is the endpoint of the region in which the bucket is located. For more information, see Regions and endpoints.

    • [$Object] is the path to the object that you want to access.

Applicable scope

  • OSS

  • On this page (1, T)
  • Problem description
  • Causes
  • Solutions
  • Applicable scope
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare