I didn’t test that. I’m not sure that would work. At the very least you’d have to clear your Cloudflare cache after every rebuild.
It’s okay with me to clear the cache after every rebuild. What else would possibly go wrong if I make a rule to cache everything in
https://myforum.com/assets/ ? Will this anyway affect user login? If you give a nod, I will test it for a week and report. I still have one unused rule.
Just to clarify, is it correct we do not use this field (as well as CDN URL) if we are using cloudflare CDN?
I have setup cloudflare.template in app.yml as per docs.
Is any further config needed if using cloudflare?
I just successfully used StackPath as CDN. Works as expected!
Is it still the case nowadays?
It seems we have to be extra careful and that we lose some of Cloudflare benefits.
So, is Cloudflare reliable and efficient with Discourse today? Does disabling the “Rocket Loader” feature minimize the benefits?
I was thinking of moving from Stackpath to Bunny CDN, but the owner of my forum domain and former admin has a cloudflare enterprise account (he’s the owner of tinyURL btw) on which he could add the domain for free (Looking for a decrease in the forum fees in the future - #6 by Gilby - Forum Feedback - Unicyclist.com).
So, I wonder if it’s right, painless and effective to use Cloudflare instead of Bunny CDN.
If you’re image-heavy then what you’ll spend increasing directly attached SSD will be far costlier than the equivalent S3 costs.
S3 does need a CDN in front of it to be cost effective as you’re billed on ingress and egress, but it’s still vastly cheaper than just slapping on more high speed SSD. CloudFlare can front S3, but asset caching is really the only feature you can use reliably. Putting CloudFlare between the client and the application server will also increase the number of hops and push application latency up. It’s no magic bullet.
We’re not image-heavy. The goal of the CDN would be so the assets load fast to every user since our community is international (mainly US and Europe).
We use S3, but only to store backups.
Quick question. Is a rebake mandatory after we change our CDN? Or is it just if the CDN URL is different? Or is it not needed at all?
edit: or is it simply possible to replace the old URLs in the cooked posts by the new one with a rails script?
For example, if I have a post containing:
title="Riding a unicycle part 76: Sullivan Canyon - Los Angeles"
style="aspect-ratio: 480 / 360;">
Could I do a search & replace strings from
newcdn.unicyclist.com without breaking anything? It seems safe, but I want to be sure about what I do.
I don’t mind rebaking all my posts, but the problem I faced the first time is that I have thousands of embedded youtube videos, and my IP was blacklisted by Youtube during the rebake because of too many requests to youtube.
So, if there’s a safe alternative than rebake all the posts and face the same annoying issue, I’d prefer to go for the alternative…
There is a rake task that will do a replacement. I think they running that is safe and a good idea. Replace a string in all posts is what you’re looking for, I think.
I’m not sure about using the rake task.
The CDN URLs seem to be present in the cooked fields rather than the raw fields (unless the message was sent by email).
From what I understand,
post:remap search for the string in the raw field only.
If replacing the CDN URLs in both the raw and cooked fields is safe, I guess I should go with a custom rails script?
You’re right. There’s another . . . thing . . . that will replace a string in all fields in the database. That’s the one you’re looking for. Sorry but I can’t find it right now. There are some topics about moving from one s3, but there doesn’t seem to be a #howto.
Thank you for this clue!
I guess it’s this?
And used here:
If it’s a safe alternative to a rebake when changing our CDN service, a #howto could be nice indeed.
Oh hooray. Thanks for letting me know. I thought it would be enough for you to find it. Glad you got it.
Hello, Will this be necessary for a forum that will not be launched globally?
In most of cases no. But at same time it depends how big is a local are and how good are connections.
In USA CDN is quite good option but in Europe not so much.
Is possible to integrate the CDN on post images, like using S3 but with local (good one) storage?
I mean changing URLs on post images for CDN one’s
That’s what this topic describes doing. You need to rebake your posts for it to apply to existing posts.
Oh, I see! What can be causing that images didn’t get updated?
I tried rebuilding, CDN addresses and images are working OK but Discourse just chose the default path and not CDN ones.
(I’m not using or selecting ‘use images with S3’ related options)
If you click the wrench and rebuild html, you’ll see that the post now refers to the CDN.
Then you can rebake all the posts with images Rebake all posts matching a pattern