Is it possible to "hotlink" SSO avatars?

So, SSO allows overriding avatars, but if I’m not mistaken it just downloads the avatar image and stores them in the Discourse system.

Is it possible to actually allow overriding the URL, maybe providing a set of multiple prescaled images? I’m storing them on S3 with a Varnish cache in front, so it reduces my caching effectiveness and more or less doubles the costs to have two sets of avatars.

You can specify a set of fixed randomly chosen avatars for new users in site settings, not sure if that is exactly what you are asking for.

If you avatars are in a path like https://example.com/avatar/username it’s possible in a site setting.

I’m asking for the SSO Avatar URL not to be mirrored by Discourse, but just directly rendered onto the page.

You can also use the external system avatar functionality.

color becomes a rudimentary hash of the username, so just plug this in for the site setting:

https://yoursite.com/avatar/discourse?h={color}

(this will not work for hosted Discourses, interestingly, as that setting is set as a global override at the current time)

2 Likes

To do this would require a redirect for each avatar, which seems rather messy. It’d be nice if I could use external_id in there, then I could generate the actual URLs

1 Like