A Traefik middleware plugin that implements the WebFinger Protocol (RFC 7033) for service discovery.
To configure the WebFinger plugin in your Traefik instance:
# Static configurationexperimental:plugins:webfinger:moduleName: github.com/NX211/traefik-webfingerversion: v0.1.0
# Dynamic configurationhttp:middlewares:my-webfinger:plugin:webfinger:domain: "example.com"resources:"acct:user@example.com":subject: "acct:user@example.com"aliases:- "https://example.com/user"links:- rel: "http://webfinger.net/rel/profile-page"type: "text/html"href: "https://example.com/user"- rel: "self"type: "application/activity+json"href: "https://example.com/users/user"passthrough: false
http:routers:my-router:rule: "Host(`example.com`)"service: my-servicemiddlewares:- my-webfinger
Option | Type | Required | Default | Description |
---|---|---|---|---|
domain | string | Yes | "" | The domain this WebFinger service handles |
resources | map | No | {} | Map of WebFinger resources and their responses |
passthrough | bool | No | false | Whether to pass through to backend when resource not found |
Each resource in the resources
map can have the following properties:
Property | Type | Required | Description |
---|---|---|---|
subject | string | Yes | The resource identifier |
aliases | []string | No | Alternative identifiers for the resource |
links | []Link | No | Related links for the resource |
Each link in the links
array can have:
Property | Type | Required | Description |
---|---|---|---|
rel | string | Yes | The link relation type |
type | string | No | The content type of the linked resource |
href | string | No | The URL of the linked resource |
titles | map[string]string | No | Titles in different languages |
properties | map[string]string | No | Additional properties |
http:middlewares:webfinger:plugin:webfinger:domain: "example.com"resources:"acct:alice@example.com":subject: "acct:alice@example.com"aliases:- "https://example.com/alice"links:- rel: "http://webfinger.net/rel/profile-page"type: "text/html"href: "https://example.com/alice"
To query a WebFinger resource:
curl "https://example.com/.well-known/webfinger?resource=acct:alice@example.com"
Example response:
{"subject": "acct:alice@example.com","aliases": ["https://example.com/alice"],"links": [{"rel": "http://webfinger.net/rel/profile-page","type": "text/html","href": "https://example.com/alice"}]}
To build and test the plugin:
# Run testsgo test ./...# Build the plugingo build ./...
For local development, you can use Traefik's plugin development mode:
# Static configurationexperimental:localPlugins:webfinger:moduleName: github.com/NX211/traefik-webfinger
This project is licensed under the Apache License 2.0. See the LICENSE file for details.