WebFinger and static sites

1. Output of caddy version:

Latest caddy2 docker image

2. How I run Caddy:

docker

a. System environment:

docker

b. Command:

whatever the docker image runs

c. Service/unit/compose file:

default docker

d. My complete Caddy config:

just the default for now

3. The problem I’m having:

WebFinger is a nice idea for binding your blog to your identity. E.g. your mastodon account. Unfortunately the webfinger specification is written so that it assumes code is responding to your GET /.well-known/webfinger?resource=$what request. I (and many others) run our blogs as static web pages. Ideally webfinger would have been specified as /.well-known/webfinger/acct/example.com/carol instead of /.well-known/webfinger?resource=acct:carol@example.com.

Can a caddy rewrite rule be used to transform from the GET params to a file name? Or do I have to just specify a static file for /.well-known/webfinger which then returns my info regardless of the resource/query?

4. Error messages and/or full log output:

none yet

5. What I already tried:

googling and reading relevant documentation

6. Links to relevant resources:

https://webfinger.net/

You can run docker exec -it <container-name> caddy version to check the version you have. You might not actually have the latest, unless you ran docker pull to update it.

Yes, absolutely. You can use the query matcher to match specific well-known values, and rewrite to some other file if it matches.

@webfinger-carol {
	path /.well-known/webfinger
	query resource acct:carol@example.com
}
rewrite @webfinger-carol /.well-known/webfinger/carol.html

You could use the map directive if you have a lot of these to make it simpler:

handle /.well-known/webfinger {
	map {query.resource} {user} {
		acct:carol@example.com carol
		acct:bob@example.com bob
	}
	rewrite * /.well-known/webfinger/{user}.html
}
1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.