Closed dlepaux closed 3 months ago
hey @dlepaux CldImage actually supports a config
prop where you can do just that!
you can add it with:
<CldImage config={{
url: {
secureDistribution: 'spacejelly.dev',
privateCdn: true
}
}} />
now unfortunately that isn't globally configurable. one way to support that globally is to create a wrapper component, then use that wrapper component, but that's also not ideal, so perhaps your idea would be a good way to support it globally
part of the issue is Next.js doesn't have an native way for me to be able to add global configurations and i want to avoid adding individual environment variables for every little configuration, but i think cname is likely one that makes sense as an environment variable, particularly because it may change depending on the environment being used
I'll try to work up a PR for this!
Hey @colbyfayock ! Thank you for your quick answer.
Do you know if by configuring a custom domain (CNAME), does the regular cloudinary URLs are still valid ?
Thanks
:tada: This issue has been resolved in version 6.5.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
in addition to the config prop, privateCdn and secureDistribution are now configurable as environment variables:
NEXT_PUBLIC_CLOUDINARY_SECURE_DISTRIBUTION="<Your Secure Distribution / CNAME>"
NEXT_PUBLIC_CLOUDINARY_PRIVATE_CDN="<true|false>"
i opted not to support the cname property as it's considered legacy and only available in the context of non-secure requests, but let me know if that creates problems
https://cloudinary.com/documentation/cloudinary_sdks#configuration_parameters
Feature Request
Cloudinary permits to custom the CDN but
next-cloudinary
, especially,CldImage
, doesn't give access to this.See your own documentation: https://cloudinary.com/documentation/cloudinary_sdks#cross_sdk_info https://cloudinary.com/documentation/advanced_url_delivery_options#private_cdns_and_cnames https://support.cloudinary.com/hc/en-us/articles/202520562-Can-we-deliver-our-assets-using-a-subdomain-of-our-own-domain-like-cdn-example-com
Potential Solution
As for the configuration of the cloudName
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="<Your Cloud Name>"
in.env
file. It would be very much appreciated to have the same way to configure a custom CDN. For example:NEXT_PUBLIC_CLOUDINARY_CNAME="<Your CNAME>"
Or to have a way to pass the CNAME directly to CldImage component.
Thanks