Am I right that cdn can only cache the files in my site and can’t cache hotlinked files from another site?
I store catalogue files (mps and pictures) on another server and hotlink them on my Discourse site. Am I right that such files won’t be cached by cdn? Is there a way to cache the hotlinked files too?
Unless you tell discourse not to, it will pull those remote images to its own image store. The below assumes you turned that off.
You should put that site behind CDN and then share the CDN url to discourse.
If you put a CDN in front of your image site but share the origin url to discourse, You can use a built in feature to replace the origin url with the CDN url .
Am I right, that if I activate the CDN feature in Discourse and switch off saving the origin to Discourse, the cdn service will cache these external files and Discourse will replace all the links to files hotlinked from another site?
I doubt that can caches external files hotlinked from other sites. Can anybody approve it?
FYI - I’ve posted a new thread on how to setup full site CDN acceleration (and SSL termination) using AWS Cloudfront here (link below). There be dragons here - so tread lightly.
At present days 2023, does the below four rules still needed to follow strictly? For example, if I were to use Akamai, which is designed to make the main domain name with its CDN accelerating. Does any one has a distilled configuration of below rules, such as should message bus and long polling still need to request to origin? Where these settings should go? long polling base url seems is removed from admin dashboard?
So “long polling base url” has to be set through Rails console. As it has been removed from admin dashboard. I must miss the reason posted in anywhere before why it’s removed if the setting still required to enable the site working well in Full site CDN mode.
Likewise, DISCOURSE_ENABLE_CORS: true has to be set in app.yml.
You should set it with an env variable (DISCOURSE_LONG_POLLING_BASE_URL) in your app.yml. It’s hidden because very few people need to set it and it’s assumed that if you’re doing that you know what you’re doing.
Thanks, @pfaffman! I should have known all these capitalised variable should go into app.yml.
So, what the use cases of message-bus will take effect? For example, a reply to a post causing notification etc? I would do a use cases testing to ensure whether or not message-bus in my site working as expected w/o DISCOURSE_LONG_POLLING_BASE_URL set.
This list definitely give more insights of the Discourse.
I’ve setup the CDN with my website, it has reached edge caches, however haven’t experienced message-bus issue with its response headers with, but still doesn’t feel solid. Neither set CORS settings.
No, I use the Akamai CDN, which supports cache dynamic content.
From the first post in this thread, it looks I should set the DISCOURSE_CDN_URL as non full site CDN does, though the URL is the same as the website URL. I am just not sure if setting it causes my site broken and other irreversible results, in the end I have to reinstall the software from scratch. In this post Full Site CDN Using AWS CloudFront, the author doesn’t set and leave DISCOURSE_CDN_URL unchanged, and it doesn’t require a separate URL to serve message-bus/long-polling. I use this solution and my website is running well so far. The only drawback of the solution is that there’re many relative URL (no base URL, as DISCOURSE_CDN_URL value is empty) presenting in the page source, which makes it look not a production level website.
Following up my questions, I found a similar post that is that I’m asking in this post CloudFront not caching static files - #4 by Falco
Appreciated @Falco answer, in this Full site CDN setup, can I set the DISCOURSE_CDN_URL the same as DISCOURSE_HOSTNAME? As I assume the Full site CDN means CDN accelerate the URL of hostname which makes the DISCOURSE_CDN_URL the same as DISCOURSE_HOSTNAME. But here’s no a decent document about this in meta.