Md at debian.org

tales of a debian maintainer

Using a custom domain as the Mastodon identity

I just did again the usual web search, and I have verified that Mastodon still does not support managing multiple domains on the same instance, and that there is still no way to migrate an account to a different instance without losing all posts (and more?).

As much as I like the idea of a federated social network, open standards and so on, I do not think that it would be wise for me to spend time developing a social network identity on somebody else's instance which could disappear at any time.

I have managed my own email server since the '90s, but I do not feel that the system administration effort required to maintain a private Mastodon instance would be justified at this point: there is not even a Debian package! Mastodon either needs to become much simpler to maintain or become much more socially important, and so far it is neither. Also, it would be wasteful to use so many computing resources for a single-user instance.

While it is not ideal, for the time being I compromised by redirecting WebFinger requests for md@linux.it using this Apache configuration:

<Location /.well-known/host-meta>
  Header set Access-Control-Allow-Origin: "*"
  Header set Content-Type: "application/xrd+xml; charset=utf-8"
  Header set Cache-Control: "max-age=86400"
</Location>

<Location /.well-known/webfinger>
  Header set Access-Control-Allow-Origin: "*"
  Header set Content-Type: "application/jrd+json; charset=utf-8"
  Header set Cache-Control: "max-age=86400"
</Location>

# WebFinger (https://www.rfc-editor.org/rfc/rfc7033)
RewriteMap lc int:tolower
RewriteMap unescape int:unescape
RewriteCond %{REQUEST_URI} ^/\.well-known/webfinger$
RewriteCond ${lc:${unescape:%{QUERY_STRING}}} (?:^|&)resource=acct:([^&]+)@linux\.it(?:$|&)
RewriteRule .+ /home/soci/%1/public_html/webfinger.json [L,QSD]
# answer 404 to requests missing "acct:" or for domains != linux.it
RewriteCond %{REQUEST_URI} ^/\.well-known/webfinger$
RewriteCond ${unescape:%{QUERY_STRING}} (?:^|&)resource=
RewriteRule .+ - [L,R=404]
# answer 400 to requests without the resource parameter
RewriteCond %{REQUEST_URI} ^/\.well-known/webfinger$
RewriteRule .+ - [L,R=400]

This is the equivalent lighttpd configuration:

  $HTTP["url"] =~ "^/\.well-known/" {
    setenv.add-response-header += (
      "Access-Control-Allow-Origin" => "*",
      "Cache-Control" => "max-age=86400",
    )
  }

  $HTTP["url"] == "/.well-known/host-meta" {
    mimetype.assign = ("" => "application/xrd+xml; charset=utf-8")
  }

  $HTTP["url"] == "/.well-known/webfinger" {
    mimetype.assign = ("" => "application/jrd+json; charset=utf-8")
    $HTTP["querystring"] =~ "(?:^|&)resource=acct:([^&]+)@linux\.it(?:$|&)" {
      alias.url = ( "" => "/home/soci/$1/public_html/webfinger.json" )
    } else {
      alias.url = ( "" => "/does-not-exist" )
    }
  }

About

This is the blog of Marco d'Itri.

S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

See also:

My blogroll:


W3C HTML 4.01
W3C CSS 2.0     

Powered by Bryar.pm.