So files will not synchronise with my system, cloudfront just cache them. Am i true?
「いいね!」 3
pfaffman
(Jay Pfaffman)
2021 年 5 月 8 日午後 12:48
82
Yes. That is correct. The CDN gets from your site just the assets that are requested of it.
Discourse will push to S3 static assets (like css and javascript) as well I uploads.
「いいね!」 4
Pravi
(PK)
2021 年 6 月 25 日午後 7:27
83
Is it possible to use cloudflare rules to cache static assets like css and javascript?
「いいね!」 2
bartv
(Bart )
2021 年 6 月 26 日午前 6:23
84
Yes, we use it that way and it works well. Just be very careful to disable any javascript optimizations. You can see our setup here:
I’m using Cloudflare on my Discourse site and it works fine. You basically route all your traffic through Cloudflare and tell it what to process or cache and that’s it. There are a few things to keep in mind though:
Configure Cloudflare to NOT cache anything (set up exceptions using page rules, see below).
Don’t let Cloudflare touch your Javascript - specifically, turn off Rocket Loader.
I’m not sure about Brotli compression yet, I disabled it.
Set up page rules to cache the avatar and upload …
「いいね!」 4
Pravi
(PK)
2021 年 6 月 26 日午前 7:16
85
Thanks for the response.
I have already added the second and third rule but I didn’t get the first rule. What’s the need for 301 redirect??
「いいね!」 2
bartv
(Bart )
2021 年 6 月 26 日午前 7:41
86
You don’t need it; it’s in the description.
「いいね!」 3
Pravi
(PK)
2021 年 6 月 26 日午前 10:37
87
Thanks for the response. What about the static assets like css and javascripts? Any rule possible for css and javascript??
「いいね!」 2
bartv
(Bart )
2021 年 6 月 26 日午前 10:51
88
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.
「いいね!」 2
Pravi
(PK)
2021 年 6 月 26 日午後 1:35
89
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.
「いいね!」 2
MarcP
(MarcP)
2021 年 9 月 16 日午前 2:40
92
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?
「いいね!」 1
CDNとしてStackPathを正常に使用しました。期待どおりに動作します!
「いいね!」 2
Canapin
(Coin-coin le Canapin)
2022 年 7 月 26 日午前 9:30
95
これは現在も同様でしょうか?
2019年より:
I’m using Cloudflare on my Discourse site and it works fine. You basically route all your traffic through Cloudflare and tell it what to process or cache and that’s it. There are a few things to keep in mind though:
Configure Cloudflare to NOT cache anything (set up exceptions using page rules, see below).
Don’t let Cloudflare touch your Javascript - specifically, turn off Rocket Loader.
I’m not sure about Brotli compression yet, I disabled it.
Set up page rules to cache the avatar and upload …
細心の注意を払う必要があり、Cloudflare のメリットの一部を失うようです。
2020年より:
Cloudflare isn’t broken, your implementation was.
Let’s Encrypt won’t enroll a certificate while CloudFlare is proxying. It prevents the verification from going through.
You can’t use any of their ‘performance’ features with Discourse as it alters the already-minified code.
All CloudFlare can do for you is hide your IP and act as a CDN for your uploads. The benefits are minimal.
2021年より:
Cloudflare is fine - just disable their Rocket Loader feature.
With no configuration effort, it saves half the bandwidth back to my server.
It might be that years ago Cloudflare didn’t work well with Discourse, but it’s not true today. It would be nice if we didn’t keep seeing doubt about it. If anyone has a specific problem, they should start a support thread here describing what’s not working.
では、Cloudflare は今日の Discourse で信頼性が高く効率的でしょうか?「Rocket Loader」機能を無効にすると、メリットは最小限になりますか?
Stackpath から Bunny CDN に移行しようと考えていましたが、私のフォーラムドメインの所有者であり元管理者でもある人物が Cloudflare のエンタープライズアカウント(tinyURL の所有者でもあります)を持っており、そこにドメインを無料で追加できるとのことです(https://unicyclist.com/t/looking-for-a-decrease-in-the-forum-fees-in-the-future/274858/6)。
そこで、Bunny CDN の代わりに Cloudflare を使用するのは、適切で、手間がかからず、効果的なのか疑問に思っています。
「いいね!」 2
Stephen
(Stephen)
2022 年 7 月 26 日午前 11:01
96
画像が多い場合、直接接続されたSSDを増設するためにかかる費用は、同等のS3費用よりもはるかに高くなります。
S3は、インバウンドとアウトバウンドの料金が発生するため、費用対効果を高めるにはCDNが必要ですが、それでも高速SSDを増設するよりもはるかに安価です。CloudflareはS3の前に配置できますが、アセットキャッシュが唯一確実に使用できる機能です。Cloudflareをクライアントとアプリケーションサーバーの間に配置すると、ホップ数が増加し、アプリケーションのレイテンシが上昇します。それは魔法の弾丸ではありません。
「いいね!」 2
Canapin
(Coin-coin le Canapin)
2022 年 7 月 26 日午前 11:45
97
画像はそれほど多くありません。CDNの目標は、コミュニティが国際的(主に米国とヨーロッパ)であるため、すべてのユーザーにアセットを高速で読み込めるようにすることです。
S3を使用していますが、バックアップの保存にのみ使用しています。
「いいね!」 1
Canapin
(Coin-coin le Canapin)
2022 年 8 月 25 日午後 4:38
98
簡単な質問です。CDNを変更した後に再ベイクは必須ですか?それともCDNのURLが異なる場合のみですか?それとも全く必要ないのでしょうか?
編集:または、レールスクリプトを使用して、クックされた投稿の古いURLを新しいURLに置き換えるだけで可能ですか?
例えば、次のような投稿がある場合:
<img class="ytp-thumbnail-image"
src="https://f5i4i8k5.stackpathcdn.com/uploads/default/original/3X/f/3/f3bc5ab19cc0394f33fd008e90ca06e081886a0b.jpeg"
title="Riding a unicycle part 76: Sullivan Canyon - Los Angeles"
width="480"
height="360"
loading="lazy"
style="aspect-ratio: 480 / 360;"
>
f5i4i8k5.stackpathcdn.com から newcdn.unicyclist.com への文字列の検索と置換を、何も壊さずに実行できますか?安全なように思えますが、確信が持てません。
すべての投稿を再ベイクしても構いませんが、前回直面した問題は、数千個の埋め込みYouTube動画があり、再ベイク中にYouTubeへのリクエストが多すぎたためにIPがYouTubeからブラックリストに登録されたことです。
そのため、同じ厄介な問題に直面してすべての投稿を再ベイクする以外の安全な代替手段があれば、そちらを選択したいです…
「いいね!」 3
pfaffman
(Jay Pfaffman)
2022 年 8 月 26 日午前 7:25
99
すべての投稿内の文字列を置換するrakeタスクがあります。それを実行しても安全で良い考えだと思います。すべての投稿内の文字列を置換する がお探しのものだと思います。
「いいね!」 2
Canapin
(Coin-coin le Canapin)
2022 年 8 月 26 日午前 9:52
100
ジェイさん、こんにちは。
rakeタスクの使用については、確信が持てません。
CDNのURLは、raw フィールドではなく、cooked フィールドに存在するようです(メールで送信された場合を除く)。
私の理解では、post:remap は raw フィールド内の文字列のみを検索します。
end
puts
puts "#{i} posts normalized!"
end
def remap_posts(find, type, ignore_case, replace = "")
ignore_case = ignore_case == 'true'
i = 0
Post.raw_match(find, type).find_each do |p|
regex =
case type
when 'string' then
Regexp.new(Regexp.escape(find), ignore_case)
when 'regex' then
Regexp.new(find, ignore_case)
end
new_raw = p.raw.gsub(regex, replace)
raw フィールドと cooked フィールドの両方でCDNのURLを置き換えることが安全であれば、カスタムRailsスクリプトを使用すべきでしょうか?
「いいね!」 2
pfaffman
(Jay Pfaffman)
2022 年 8 月 26 日午後 3:02
101
おっしゃる通りです。データベース内のすべてのフィールドの文字列を置き換える別の「もの」があります。それがお探しのものです。申し訳ありませんが、今は見つけられません。あるs3から別のs3への移行に関するトピックはいくつかありますが、howto のようなものはないようです。
「いいね!」 2
Canapin
(Coin-coin le Canapin)
2022 年 8 月 26 日午後 3:55
102
この手がかりをありがとうございます!
これのことだと思いますか?
DbHelper.remap('from', 'to')
Rebaking old posts won't pull new S3 CDN URL after S3 bucket rename - #10 by Brad_Wood で見つけました。
そしてここで使用されています:
raise failure_message
elsif s3_objects.size + synced >= local_files.size
log "Updating the URLs in the database..."
from = "/uploads/#{@current_db}/original/"
to = "#{SiteSetting.Upload.s3_base_url}/#{prefix}"
if @dry_run
log "REPLACING '#{from}' WITH '#{to}'"
else
DbHelper.remap(from, to, anchor_left: true)
end
[
[
"src=\"/uploads/#{@current_db}/original/(\\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\\.]*)",
"src=\"#{SiteSetting.Upload.s3_base_url}/#{prefix}\\1"
],
[
"src='/uploads/#{@current_db}/original/(\\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\\.]*)",
"src='#{SiteSetting.Upload.s3_base_url}/#{prefix}\\1"
CDNサービスを変更する際の、リベイクの安全な代替手段であれば、howto があれば確かに良いでしょう。
「いいね!」 3
pfaffman
(Jay Pfaffman)
2022 年 8 月 26 日午後 4:41
103
Coin-coin le Canapin:
この手がかりをありがとう
おめでとうございます。お知らせいただきありがとうございます。それで見つけられると思っていたのですが、見つかってよかったです。
「いいね!」 3