There are many reasons why you may be receiving a 40X error when attempting to access your resources. Below you can find additional information including the most common reasons you might see such an error.
400 - Bad Request:
A 400 - Bad Request error would be returned when the delivery URL is invalid or not in the correct format/structure. For example, you will receive this error if you attempt to use a transformation key or value that doesn't exist or is not valid (e.g 'ab_cd' or width 0 - 'w_0').
Another reason could be if you attempt to use valid but conflicting transformations options. For instance, attempting to use the Automatic Gravity (g_auto) transformation with a crop mode that doesn't actually crop the image, such as "scale" which keeps all image data so no cropping occurs.
Finally, another common reason is if your delivery URL is not in the right structure, such as if your cloud_name comes after the 'resource_type' (e.g. image) and 'type' (upload) or if the transformation options are added in the middle of the public_id. You can find out more details about the structure of Cloudinary URLs in the following section of our documentation:
https://cloudinary.com/documentation/image_transformations#transformation_url_structure
401 - Unauthorized
This error is returned when there is some restriction in place which is preventing the successful delivery of the requested asset. Common reasons include, if you are using Strict Transformations and attempting to generate a derived on-the-fly for a transformation that is not marked as allowed/whitelisted in your cloud and if the URL is not Signed.
You will also receive this error if you attempt to use an addon or feature that is restricted as part of the Settings -> Security tab in Cloudinary. An example of this would be trying to use Resource Lists (aka Client-side asset lists) if this feature is restricted under the 'Restricted media types' field of the Settings -> Security tab in your cloud.
Finally, this error can be returned if you are attempting to access a 'private' original asset or an 'authenticated' asset without supplying a valid Signed URL.
404 - Not Found
A 404 Not Found error would be returned if the requested resource is not found in your cloud and you are not using a default/placeholder image transformation.
Error caching:
Cloudinary caches 40X errors in an exponential backoff manner, first for 1 minute and each subsequent request for the same URL that leads to the error will double the expiry time up until a maximum of 24 hours.
This error cache is most often encountered for 404 Not Found errors when derived/transformed versions of original images are requested, but that original image hasn't yet been uploaded. If you are seeing a 40X error such as a 404, but upon checking the original image is indeed in your cloud, then a cached error is the likely explanation.
We have a support article which you can find below that provides more information about Cloudinary's error caching:
https://support.cloudinary.com/hc/en-us/articles/202520452-I-m-getting-a-404-or-other-40x-erros-for-my-transformed-image-while-other-versions-of-that-image-work
X-Cld-Error header:
When Cloudinary returns an error for an asset's delivery URL that failed to load due to a problem with the asset or URL, we return an HTTP header containing more information about why the request failed.
We also return this header for requests where an image was returned but there was a warning, such as when the default image placeholder was sent instead of the requested image.
This information is sent in the 'x-cld-error' header, and you can see the value by using your browser's web developer tools to examine the request and response for the image which didn't load correctly.
If none of the above scenarios explains the issue you are seeing or if you have any questions, please create a ticket with us through - https://support.cloudinary.com/hc/requests/new - and our team would be able to assist.
Comments
0 comments
Please sign in to leave a comment.