Set src with API request
I'm trying to set the src for an iframe using the Cloudinary API, everything's uploaded correctly but when I'm setting the src I either get a status 400 bad request error of the file downloads instead.
The src file is a .html file and below you'll find the link formats I'm trying, any help would be appreciated.
400 bad request:
-
Hey Reece, thanks for reaching out.
It looks like you're trying to render an HTML file that is stored in Cloudinary inside of an iframe.
Cloudinary allows uploading static content such as CSS, HTML, and JS files, and serving those files via our worldwide CDN.However, for security reasons, HTML files are served along with the content-disposition header which forces it to download, so delivering your web pages isn't applicable with Cloudinary.
By the way, looking at the logs, it seems that the file that you've mentioned (".../index_nttzpp.html"), has the delivery type of "upload". The triplet of delivery type, resource type (which is "raw" in that case), and public ID, serve as a unique identifier in a Cloudinary cloud. You cannot change the delivery type of an asset by simply requesting a different type - That is the reason you've received a 400 error.
Additional details can be found here -
https://cloudinary.com/documentation/image_transformations#delivery_typesHope this helps, please let me know if you have any further questions.
0
Post is closed for comments.
Comments
1 comment