Add custom HostName to CDN

I want to have a custom CDN hostname for my website. I know that discord does that so it must be possible, how can I do that too?

bump because no one saw it before

Can you please be more specific? A site on Cloudflare doesn’t use a custom hostname for the CDN feature. All traffic goes through the same hostname, and static files are cached at the edge automatically.

(post deleted by author)

If i for example have an image. 1.png and if I visit it. The url will be example.com/1.png. I want to to have a subdomain for CDN like cdn.example.com/1.png. How can i do that

The way Cloudflare works, you can just use example.com/1.png and it will be cached by the CDN automatically. There is no need for a special subdomain for the CDN; it is transparent.

Alright but is there a way to get a subdomain for the CDN?

what part are you stuck on? what have you tried so far? what issue are you encountering?

have you created a DNS entry for the subdomain? have you orange-clouded the DNS entry?

if you’re intending to have a subdomain with only images and other non-HTML assets, be careful though, as websites you proxy through Cloudflare are supposed to be “normal” websites with a reasonable mix of HTML and non-HTML assets. If your subdomain is serving only images and no HTML, it could potentially get flagged.

If you want to play it safe and make sure you’re within the terms of use, you could use R2, a Worker, and this script: GitHub - kotx/render: Cloudflare Worker to proxy and cache requests to R2

make sure you review the pricing structure for R2 and Workers