Skip to content

Instantly share code, notes, and snippets.

@aslakr
Last active May 23, 2023 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslakr/6a7306bf74080eea4498c19fb418073a to your computer and use it in GitHub Desktop.
Save aslakr/6a7306bf74080eea4498c19fb418073a to your computer and use it in GitHub Desktop.
".well-known/avatars" as an alternative/addition to DNS SRV for federated libravatars?

https://lists.launchpad.net/libravatar-fans/msg00084.html

Looking at WebFinger and its avatar link rel I was wondering if one could use a .well-known/avatars or something similar as an alternative/addition to DNS SRV records federated avatars server?

E.g. either add something like:

https://example.com/.well-known/avatars

or

https://example.com/.well-known/avatars-server

which responds with the avatars-server (and maybe port/path) to Well-Known URIs?

Or maybe it would fit better to use RFC 6415's .well-known/host-meta or even WebFinger?


https://lists.launchpad.net/libravatar-fans/msg00088.html

On 10 Nov 2018, at 13:41, Aslak Raanes wrote:

Looking at WebFinger and its avatar link rel I was wondering if one could use a .well-known/avatars or something similar as an alternative/addition to DNS SRV records federated avatars server?

Just to clarify, I was thinking this might be a solution for libravatar/avatars servers that can't or won't modify their DNS (and maybe libravatar clients that can't do DNS SRV lookups).

Given an adress George@example.com a client would:

> GET /.well-known/avatars-server HTTP/1.1
> Host: example.com
>
< HTTP/1.1 200 OK
< Content-Type: text/plain
<
avatars.example.com

implying that avatars can be found at https://avatars.example.com/avatar/ (only https?)

Given that there are som some gravatar-ish implementations like Confluence Avatar Server that use a rather different path, i.e. something like https://confluence.example.com/rest/cas/1.0/avatar/server/ it seems, should it be possible to return full URI? Something like:

> GET /.well-known/avatars-server HTTP/1.1
> Host: example.com
>
< HTTP/1.1 200 OK
< Content-Type: text/plain
<
https://avatars.example.com/different-path/

? (and should it be possible to add a TXT path=different-path/ to the DNS SRV?)

Should a client cache the response for at least 24 hours?

Or instead of defining a new /.well-known/ URI, maybe it's better to use WebFinger and reuse avatar link rel instead?

> GET /.well-known/webfinger?
>   resource=mailto%3AGeorge%40example.com&
>   rel=http%3A%2F%2Fwebfinger.net%2Frel%2Favatar
>   HTTP/1.1
> Host: example.com
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/jrd+json
<
{
    "subject" : "mailto:George@example.com";,
    "links" :
    [
        {
        "rel" : "http://webfinger.net/rel/avatar";,
        "href" : "https://avatars.example.com/avatar/40f8d096a3777232204cb3f796c577b7";
        }
    ]
}

And if the resource query is just the domain (I'm not sure if that's legal in WebFinger), return the avatars server:

> GET /.well-known/webfinger?
>   resource=example.com&
>   rel=http%3A%2F%2Flibravatar.org%2Frel%2Frel%2Fserver
>   HTTP/1.1
> Host: example.com
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/jrd+json
<
{
    "subject" : "example.com",
    "links" :
    [
        {
        "rel" : "http://webfinger.net/rel/avatar";,
        "href" : "https://avatars.example.com/avatar/";
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment