S3 with CDN image link broken on user card and profile background



On my site (let’s say foo.com), I have a “Discourse CDN” set up (cdn.foo.com) to serve JS/CSS. Uploads to S3 are also enabled, and the S3 CDN is storage.foo.com. My raw S3 bucket is foo.s3.amazonaws.com.

On the user profile image, the S3 cdn gets appended to the Discourse CDN: //cdn.foo.com//storage.foo.com/xxxxx.jpg

The user card image, on my site appends raw S3 bucket to the Discourse CDN: //cdn.foo.com//foo.s3.amazonaws.com/xxxxx.jpg

I’ve tried rebakes etc., is there anything else I need to do, or is this a bug?

This commit might be related.

(Jeff Atwood) #2

What do you think @sam? This is probably very fresh in your mind…

(Sam Saffron) #3

Post this it works:

However we need to change our storage schema for S3 optimized images (and all optimised images) to allow us to send avatar templates down to the client to avoid the redirection.


Thanks, Sam, that fixes the avatar issues.

I’m still having the same issue with profile headers/cards, though. I’d turn the S3 CDN off, but direct S3 access is so slow here in NZ!

(Sam Saffron) #5

confirmed, I can see the bug … its a different bug … will fix

(Sam Saffron) #6

lets try this then:



Thanks! That solved it.

I now have the issue that when I try to upload a custom avatar, it tries to load it from: //foo.s3-us-east-1.amazonaws.com/original/4/f/xxx.jpeg when it used to be foo.s3.amazonaws.com. My S3 region is us-east-1 in the Discourse admin (I assume it used to try load it from “US Standard”)

(Sam Saffron) #8

That’s unrelated, but it seems to me that your existing uploads are in the wrong spot, open a bug on it

(Sam Saffron) #9