In a Support thread titled “Broken Image links when using S3 and CDN” tagged with cdn and s3, stevejr reports broken image links in posts despite correct S3 URLs and CDN paths. After running rake uploads:migrate_to_s3 and rake posts:rebake, images still point to <CDN URL>/uploads/default/optimized/1X/..., even though the default folder doesn’t exist in S3. pfaffman asks whether posts were actually rebaked or just flagged, and notes that newer posts may include default in paths. stevejr clarifies the posts are new, mentions recent S3 ACL changes, and suspects conflicting CDN/S3 variables might cause images to load from the direct bucket URL instead. He also asks how to verify if rebaking completed and where the default folder originates. In post 4, stevejr observes that broken images appear only when copied into posts (not uploaded directly), questioning if this is expected behavior. The thread reflects troubleshooting efforts around S3/CDN image path mismatches, rebake status, and upload vs. copy behavior in Discourse.
We are seeing some of our posts have broken image links but when you click on the link the image is displayed. I have worked through an old post that was similar - Broken Images and Their S3 URLs
However, after running rake uploads:migrate_to_s3 and rake posts:rebake I can see that the URLs in the uploads table are correct but the images are still broken. They are pointing correctly to our CDN url but for some reason still have a folder path of <CDN URL>/uploads/default/optimized/1X/<image name> but I would have expected them to be in <CDN URL>/uploads/optimized/1X/<image name> - why is the image going into the default subfolder as it doesn’t exist in the S3 bucket.
I am a loss on what the next steps should be. Can anyone help???
These are new posts but I did have to change our S3 bucket settings to allow for ACLs. Not sure if that is the issue.
I just added a new post and the image looks like it is loaded from the bucket address instead of the CDN one. Could that be because I have duplicate variables set and the direct S3 bucket address is taking priority???
Re the rebake - how do I tell if they have been rebaked or just flagged?
Lastly, where does the default subfolder value come from?
Sorry for the questions but am very new to Discourse!