How to set S3 only save user upload files

AI-generated summary

Yt.w wants to use S3 to store only user-uploaded files, not assets like JavaScript files, to potentially improve site loading times. pfaffman questions the need for this setup, suggesting it may cause problems and noting that hosted Discourse sites work this way.

Yt.w explains the reasoning behind this setup, citing the geographical distance between the Discourse server and users in Asia, and the use of Backblaze B2 as a cheap S3 solution. pfaffman assures that using a CDN would be faster than the site itself.

Yt.w wonders if using a CDN with the Discourse server in Asia would be faster than using S3 in the US. pfaffman confirms that the CDN is indeed faster.

Hello, I would like to use S3 to only save my uploaded file and I don’t want to save my assets(like js) to S3.

Is there anyway to do it?

What problem are you solving?

I think if you don’t set use_s3 then it might not upload assets, but I’ve not done that in years. It’s not supported and is likely to cause problems.

My discourse server/users are in Asia, and I am using backblaze B2 as my S3 solution.(becasue it’s cheap)

The problem that is I don’t want to save js files to S3 and let my users to load it, becuase I am thinking it will slow the site loading file.

So I would like to know if there are anyway to only S3 to store upload file.

That’s the way that all hosted discourse sites work.

You’re using a cdn, right? It’ll be faster than your site.

Yes, I am using cdn for S3.

But I still wondering, if
does discourse server(asia) → cdn → users(asia) faster than S3(US) → cdn → users(asia)?

I saw there is a parameter named DISCOURSE_S3_UPLOAD_BUCKET, it looks like a solution to me but after I replace DISCOURSE_S3_BUCKET by it. I cannot rebuild my discourse

The cdn is faster.