Need steps to change images URL to a subdomain name

Hello all,

I am looking for a proper solution with steps to convert Images URL host to a custom subdomain name. What I want is https://imagedelivery.net/Fr4LGKEYBhCFAmxASjH9ng/<image_id>/<variant_name> to https://static.sitename.come/Fr4LGKEYBhCFAmxASjH9ng/<image_id>/<variant_name> this kind of url.

I have read some of the solutions listed on the platform but I am not sure how to change the Cloudflare default image delivery url to a Custom sub-domain url.

  1. Solution 1

  2. Solution 2

@ i40west You are the man who has done some worked around on those kind of changes. Could please guide me with the same :slight_smile:

Any help would be appreciated.

Thanks

You can use any domain that’s in your account, by adding /cdn-cgi/images to the path, and you can create rules to rewrite the URLs if you want a different path. Documentation here:

1 Like

I have read the document and your solution but it isn’t working for me.

Sharing you the steps that I followed:

  1. A static subdomain added in DNS with type AAAA, name static and IPv4 address 100:: with the :orange: orange cloud turned on

  2. Added redirect rules:

  3. Open cloudflare image url in browser but it isn’t redirecting to the redirected rule.

Actual URL:

https://imagedelivery.net/Fr4LGKEYBhCFAmxASjH9ng/f6ff465e-30dd-4beb-1881-ee1d8e320400/public

Expected URL:

https://static.sitename.com/cdn-cgi/imagedelivery/Fr4LGKEYBhCFAmxASjH9ng/f6ff465e-30dd-4beb-1881-ee1d8e320400/public

Am I doing something wrong here? Please let me know.

Try changing your “URI Path” exclusion to just imagedelivery. The idea is to exclude the /cdn-cgi/imagedelivery requests, so the .net shouldn’t be in there.

2 Likes

Ahhhh, it worked now after removing .net.

Now I am able to access the URL with the static subdomain but it does not exclude the /cdn-cgi/imagedelivery path from the URL.

Is there any way to exclude that too :thinking:

Thanks for your help :smiley::pray:

Do you mean, remove that part from the final URL? The Transform Rule example in the link I shared above has an example of doing that.

Yes. I did followed that Transform rule docs before and tried it but that didn’t worked out as the dynamic rules only works on Business or WAF plan :confused: .

Oh, the regex. Right. You may have to live with that URL path.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.