New to Cloudfare, where is the cdn subdomain for images
is having cnd. as a subdomain for a website necessary? I know discord had it like that for their images but dont know if I need it, cdn mapping looks nice and seems practical but I dont want to have to pay. my website https://keehan.co runs a tad slow because of large images and am trying to fix that
19 Replies
Separate hostnames for images/content is usually used because: Wanting to avoid sending cookies/unnecessary data for loading images, or because the origin server for the content is seperate from the normal website servers, or because the main website isn't behind the cdn already
You wouldn't need to pay just to create a proxied subdomain on your existing Cloudflare DNS managed site.
Which images are you talking about? Cloudflare caches certain content types (identifiable via file extension) by default, including images. For example, https://keehan.co/shop/ 's images are all cached
Something like https://keehan.co/wp-content/uploads/2022/09/SpaceEdit.png when I run my site on https://pagespeed.web.dev/analysis/https-keehan-co/ shows slow loading speed. Are these image types not loaded on cloudfare? Also my registar is namecheap with cloudfare free nameservers, do you have an article or something you could link which explains how one would transfer content to a proxied subdomain?
That image is cached/able to e cached.
It's worth noting though that cache is (by default) per Cloudflare location/colo, which Cloudflare has 350+ of. Rerun the test a few times to see the cached results. Your items will also be evicted from cache based on access frequencies (i.e it won't live long in cache if it doesn't get many requests)
do you have an article or something you could link which explains how one would transfer content to a proxied subdomain?That would vary a ton on where it is stored and how it is used, thankfully not necessary in this instance
that's still a large/oversized image though, I imagine various web page tools would complain about size alone, might want to resize it/compress it
When I run pagespeed insights, I don't see any warning about time to first byte, but just everything else:
Your images are oversized/wrong formats/contribute to a too large network payload, too much javascript/unused javascript/blocks for too long
Not sure you can do much about the javascript side of things if your hands are tied to Wordpress, but it specifically complains about Recaptcha & Google Tag manager, could try switching out to Turnstile & Zaraz (Cloudflare solutions). Should def be able to resize your images though. Pro or higher gets Cloudflare Polish, which attempts to seamlessly optimize images on your site, but if possible, you'd be better off manually resizing them. You can expand the resize images tab to see which ones are the biggest offenders
Thanks a bunch, ill get on that right now then. The score def went up a bit from the 68 it used to be at for desktop score. Ill replace recaptcha and figure out when I even got tag manager.
I didnt quite get what you meant at the end there by its not neccesary and that image
hmm, about what?
Cloudflare Pro or higher gets Cloudflare Polish, which tries to automatically optimize your images for you. It also gets Mirage, for mobile device image optimization. However, it's faster/more consistent if you can manually optimize your images yourself.
In the PageSpeed Insights results, if you click on "properly resize images", it will tell you which ones are the largest/most needing optimization
ohhh thats what you meant by "thankfully not necessary in this instance"
ok gotcha thanks
oh I meant that in response to using a cdn subdomain
I just thought cnd.keehan.co was neccesary for optimized files and the such
oh yeah thatas what I thought at first
nah it's not at all, and it seems like it'd be a pain to get working with Wordpress
Your root domain is already proxied and benefits from all of Cloudflare's features/etc, there's no real advantage of using a cdn subdomain in this case
i see, yeah thanks for clearing all that up. i thought it just wasnt doing anything this whole time
Im guessing I can also uninstall the LiteSpeed Cache plugin now that I have cloudfare?
Your host/origin web server uses Litespeed?
no, its just an installed plugin I forgot about on wordpress
Just saw it rn when I was checking stuff
hmm it looks like it still might help, and it tries to defer/optimize some things. I would just not install more then one of those types of plugins
There's no guarantee Cloudflare will always have your assets in cache, and even if they do, Cloudflare has many locations which might not. A plugin made to optimize specific wordpress things like inling css/optimizing js also just has more knowledge/things it can work with then generic Cloudflare layer
oh ok thanks, ill keep that installed for now then until I have any problems with it or it starts to comflict with cloudfare
yea, could always try disabling it too and clearing CF Cache (in CF Dashboard, under your website -> Caching -> Configuration -> Purge Everything, to remove any pre-optimized js/etc) and seeing if it helps or hurts score/load speed
ok ill do that and see if it helps