It absolutely is when both systems are comparable.
Thereâs no need to justify that, because itâs not necessarily what it was designed for.
Just because it can retrieve images from another domain, and subsequently could mirror from another cdn doesnât mean itâs the intended purpose of the feature.
It could obviously be pointed at a folder of regular static images, in which case it would be imbuing the images with the additional functionality.
As indicated it does alleviate it under those circumstances.
If the headless CMS provides what you need, why duplicate.
If thereâs something to gain, then sure knock yourself out, but if not then why bother.
The applicable documentation, (which Iâm sure youâve already seen), is here:
https://docs.netlify.com/image-cdn/overview/#remote-path
Iâve never worked with it, so cannot speak to if it even works, but the documentation seems quite clear, you should just read it carefully and work from it.
The remote_images
property accepts an array of regex. If your images are in specific subdomains or directories, you can use regex to allow just those subdomains or directories.
The format of the URL you have specified is:
https://cdn.shopify.com/s/files/1/0252/8968/7128/files/fa_pic_027c0eb4-c897-45b8-9673-b76e88a16710.jpg.webp?v=1689025752
But what youâve indicated you have in your remote_images
is:
["https://my-shopify-site.com/.*", "https://animals.more-images.com/[bcr]at/.*"]
The second value is clearly unnecessary and taken âcopy & pasteâ from the documentation.
Iâm not sure how familiar you are with regex, but https://my-shopify-site.com/.*
wonât match https://cdn.shopify.com/s/files/1/0252/8968/7128/files/fa_pic_027c0eb4-c897-45b8-9673-b76e88a16710.jpg.webp?v=1689025752
You can use tools like https://regex101.com to check your rules against the strings youâre trying to match.
Your current rule:
A rule that actually targets the domain you mentioned:
If that doesnât work, then youâll probably need to pay attention to what the documentation says about escaping the /
:
Note that you need to double-escape regex in netlify.toml
files. For example, the string https://
can convert to a regex as https:\/\/
but you should specify it in netlify.toml
as https:\\/\\/
.