Technology Encyclopedia Home >After configuring cross-domain access, access to object storage (COS) with a header in the whitelist is denied. What should I do?

After configuring cross-domain access, access to object storage (COS) with a header in the whitelist is denied. What should I do?

If access to Tencent Cloud Object Storage (COS) is denied even after configuring cross-domain access and the header is in the whitelist, here are some steps to troubleshoot and resolve the issue:

1. Verify Cross-Origin Resource Sharing (CORS) Configuration

Ensure that your CORS configuration in COS is correctly set up to include the necessary headers.

Example Configuration:

[
    {
        "AllowedOrigin": ["*"],
        "AllowedMethod": ["GET", "POST", "PUT"],
        "AllowedHeader": ["Content-Type", "Authorization", "YourCustomHeader"],
        "ExposeHeader": ["ETag"],
        "MaxAgeSeconds": 3000
    }
]

In this example, replace "YourCustomHeader" with the actual header you are using.

2. Check Header Naming and Case Sensitivity

Ensure that the headers used in your requests exactly match those specified in the CORS configuration. Headers are case-insensitive, but it's good practice to use the correct casing.

3. Validate Request Headers

Make sure that the headers being sent in your requests are correctly formatted and include all necessary information.

4. Review Access Control Lists (ACLs) and Bucket Policies

Ensure that the bucket ACLs and bucket policies are not restricting access. Even with proper CORS configuration, restrictive ACLs or bucket policies can deny access.

5. Use COS Browser for Testing

Utilize the Tencent Cloud COS Browser tool to test access and see detailed error messages that can provide more insight into why access is being denied.

6. Enable Detailed Logging

Enable detailed logging for your COS bucket to get more information about the requests and responses, which can help identify the issue.

7. Contact Tencent Cloud Support

If the issue persists, contact Tencent Cloud Support for further assistance. They can provide more detailed guidance and help troubleshoot the problem.

By following these steps, you should be able to identify and resolve the issue with accessing COS after configuring cross-domain access.