Running into this and still very confused after reading this thread…
I’m trying to server s3 uploads (not compiled assets) from CDN (Cloudfront).
If I configure “s3 cdn url” via the settings screen, it works as expected (well…except for System upload not using s3 cdn url)
However, if I configure via DISCOURSE_S3_CDN_URL
and rebuild, the frontend is broken because its trying to load compiled assets from my s3 cdn url.
Seems DISCOURSE_S3_CDN_URL
/ s3_cdn_url
should only affect uploads, and DISCOURSE_CDN_URL should only affect assets.