Challenge
After an image is uploaded to an Alibaba Cloud Object Storage Service (OSS), request the image URL over HTTP and find that a 403 error is returned.
Cause
The following reasons are reported for the error that you cannot access the image properly:
- Bucket is private
- hotlink protection configuration exception
Solution
If an error occurs when accessing an image stored in OSS through HTTP, see the following operations for troubleshooting:
- Confirm the bucket permissions. For private permissions, proceed as follows:
- For more information about signature authentication, see User signature authentication. For more information about how to splice URLs that are used to access OSS resources with identity verification, see OSS request process.
- Change the permission to public read. For more information about how to modify the permission, see Configure the ACL.
- Confirm the hotlink protection settings. If the specified Referer is not allowed to be empty, only the specified Referer can be accessed. Access from other Referers will be blocked. Referer is empty when the browser directly requests the image URL. Therefore, a 403 error is returned if the request fails. If you do not have special requirements, you can change the setting to Allow Empty Referer. For more information, see OSS hotlink protection configurations and troubleshooting methods.
- If the problem still cannot be resolved, see Access to OSS 403 status code troubleshooting methods for troubleshooting.
References
- Troubleshoot common errors related to OSS permissions
- OSS cross-origin resource sharing (CORS) common errors and solutions
- Common errors and analytics in OSS upload callback
Applicable scope
- OSS