Search code examples
httpscloudinarykeystonejs

Force Cloudinary URLs to use HTTPS


I am trying to figure out how to force Cloudinary to use HTTPS in Keystone.

Tried using {{cloudinaryUrl image width=500 height=500 crop=‘fill’ secure=‘true’}} in the actual post.hbs page but no luck.

I've seen mention of this but cannot figure out which file the person is referring to.

cloudinary config


Solution

  • If you are serving your page in http but you want to force cloudinary to https, you can set the option in the keystone.init function : 'cloudinary secure': true,

    This option is mapped on cloudinary options described here

    keystone.init({
        'name': 'xyz',
        ...
        'cloudinary secure': true,
        ....
    

    Turning on this option changes http to https the protocol when you print an src image like this :

    src=post._.image.src({dpr:'auto'}) // pug syntax