Federation: The Friend Network
4got instances can form a peer-to-peer friend network for cache sharing, service proxying, and instance discovery. This is how multiple 4got deployments cooperate to improve speed and resilience.
Philosophy
The 4got protocol is a result-sharing protocol for self-contained queries — queries that are small, universal, and should have roughly the same answer regardless of who asks or where they ask from. Search engines are just one type of intelligence backend that can feed results into this protocol. A friend’s instance might answer a query from Google, from a custom scraper, from an AI agent, from a local database, or from another friend’s cache — the protocol doesn’t care. It exists to share answers between friends, not to replace any particular search provider. There is room for the protocol to be used with all kinds of intelligence backends beyond traditional search engines.
Overview
The friend network provides three capabilities:
- Peer cache sharing — friends share cached search results, reducing redundant upstream queries
- Service proxy — friends proxy expensive services (translation, Wolfram Alpha, autocomplete) for each other
- Instance discovery — the
/ami4gotendpoint and instance browser let users find other instances
Peer cache sharing protocol
When a search is performed, 4got asks all configured friends in parallel via GET /api/v1/cache?key=<hash>. The key is a hash of the query and its settings, so the words themselves never leave the instance. Those settings include the region and, from a reader whose first known language is not English, the language their search asks Wikimedia’s wikis in: a copy from a German reader’s search answers only a search asked in German. Friends respond with cached results if available. The ask carries X-Peer-Secret; a person may ask too, as the owner or with a group or API key that allows peer_cache. Without a peer-secret, the cache answers anyone.
Request flow
- User searches for “quantum computing”
- 4got sends the cache key to all configured friends simultaneously
- Friends check their local cache and respond with results (or 404 Not Found on a miss)
- 4got merges friend results with its own engine results using the standard scoring/deduplication algorithm
How old a friend’s copy is (age_s, protocol 1.1)
A friend’s answer carries age_s: how many seconds ago its engines answered. A copy is kept in our cache with that age, so it is never fresher here than it really is, and the results line says “(cached 4 minutes ago on alice)”, naming the friend as peers.kdl does (keep-friend-copies false shows the copy without keeping it). A friend from before protocol 1.1 sends no age_s; its copy is read as age 0, which is what every friend’s copy was before, and the line says only “(cached on alice)”. An age_s over a year is refused as a broken answer. Friends on 1.0 and 1.1 understand each other; only a different major version is logged.
A person’s own rules judge the copy first: one older than their “Never older than” limit, or without rows from an engine their “Only if it has results from” list names, is a miss. “Let the classifier judge each search” (Settings › Advanced › Cache freshness, on by default) can shorten that limit for a search whose results it judged short-lived, and then a friend’s copy may be no older than the shorter limit, as ours may not. A friend never shares rows from the engines it runs on its own API keys (share "none"), so naming one of those in the list rules out its copies. Only then does the owner’s trust for that friend apply (see configuration.md): full makes it our cache hit, preview shows it while our engines refresh our cache. When a full and a preview friend both have a copy, the full one is taken.
The push (POST /api/v1/cache)
After a fresh search, 4got sends its results to its friends (the owner’s default-friend-share, and each person’s “Send my results to this server’s friends”). The push is signed with the sender’s key and names it in X-Peer-Identity. The receiver keeps it under the friend whose key in peers.kdl signed it; a push it cannot pin on a friend (verified only by its own key, or unsigned on a server with no friends), or from a friend it blocked, is acknowledged and not kept.
The receiver’s own searches use it: after their own cache misses, a pushed copy is that friend’s copy, already here, judged exactly as one fetched from the friend, by the person’s rules and then the owner’s trust in the sender. Its age is how long ago it arrived. A full friend’s push is a cache hit, and nobody is asked; behind a preview friend’s push, only the full friends are asked, since only they could beat it. “Use no outside services” and Incognito ignore pushed copies, as they ignore friends.
A push goes one hop. It is never served to the receiver’s other friends: GET /api/v1/cache answers only with the server’s own copy. A full friend’s copy that a search took becomes the server’s own, and is served on like any other.
Preferred friends
// Prefer this friend for specific services
prefer-friend "alice" for="translation,wolfram"
Service proxy
Friends can proxy expensive API-backed services for each other. This lets a single Wolfram Alpha API key serve multiple instances, or a single translation backend serve the whole friend network.
How it works
- Instance A needs to translate text but has no DeepL API key
- Instance A sends
POST /api/v1/proxyto friend Instance B with a form-encoded body:service=translation&text=hello&target=fr. The text is in the body, not the URL, so it stays out of access logs. (A receiver also accepts the same fields in the query string, which is what older instances send.) A friend that hasn’t upgraded reads only the query string, so it rejects the body; until it upgrades, instance A falls back to its own service. - Instance B checks its
allow-proxylist, finds “translation” is allowed, performs the translation, and returns the result - Instance A uses the result as if it performed the translation locally
Supported services
translation— text translation (DeepL, Papago, Lingva, NLLB, Microsoft)wolfram— Wolfram Alpha short answers APIautocomplete— search suggestion backends
Configuration
On the provider instance (the one that actually has the API keys):
allow-proxy "translation" "wolfram" "autocomplete"
On the consumer instance (the one that wants to use the services):
prefer-friend "provider-name" for="translation,wolfram"
The consumer will try the preferred friend first, then fall back to local backends. It asks the friend only for the owner and groups that allow friend_proxy (deluxe and translator as shipped); anyone else’s text never reaches the friend, and the local backends answer as if no friend were preferred. Who may use a lent service is the consumer’s choice; the provider only chooses what it lends.
Authentication
Service proxy requests are authenticated using the peer-secret from config.kdl, sent in the X-Peer-Secret header. It is sent with mTLS too, because the receiver checks only the secret.
Relayed searches (POST /api/v1/relay)
A friend can run one web search for another, so the engines see the friend’s address instead of the asker’s. Both owners opt in, per friend, with relay true in that friend’s peer block; the lender must also list the asker’s pubkey.
The lender
- The request carries the words in a JSON body, never the URL:
{"q", "safe", "region", "page", "to", "asked_at"}, wheretois the lender’s fingerprint, so an ask cannot be replayed to another friend. A body over 16 KB gets 413. It is signed like a push:X-Result-Signature(ed25519 over the body) andX-Peer-Identity(the asker’s fingerprint), plusX-Peer-Secret. - Unsigned, signed by a key it does not list, addressed (
to) to another server, orasked_atmore than 5 minutes from its clock: 401. A friend withoutrelay true, or one it blocked: 403. - Each friend gets
relay-per-hoursearches an hour (default 60). Past them: 429 withRetry-After. The 200, 429 and 503 answers carryX-4got-Relay-Left, the searches left this hour. - The search passes the lender’s admission gate like a stranger’s. Shedding: 503 with
Retry-After, and the search is not counted. - It runs on a fixed set, the lender’s web engines whose rows it shares (never
share "none", whose rows are withheld, nor a key-requiring engine or a hand-written one using the lender’s configured key, which would spend the lender’s key), whatever the asker’s request says, at the asker’s safe-search level, never below the lender’s floor, and answers{"results": [...]}: up to 30 rows, without the rows of itsshare "none"engines. - The words are kept nowhere: no search log, no cache, no push, no trending. Only a count by outcome (
fgot_friend_relay_total) is kept.
A friend’s search on one of our engines through POST /api/v1/proxy (service=engine:<id>) is counted too, by engine (fgot_friend_engine_proxy_total), though not limited.
The borrower
The owner’s AI research sends its own searches (the agent’s search tool) through friends: one search at a time, each to the next eligible friend in turn (round-robin, in peers.kdl order). A friend is eligible with relay true and a pubkey, not blocked, its breaker closed, and not waiting out a refusal: a minute after a 503, a quarter hour after a 429, an hour after a 401 or 403. When none is eligible, or the friend asked fails, that search runs here. No classifier picks the friend. The agent also has friend_search(query, instance) to ask one friend by name.
Both are the owner’s only (or everyone’s when default-on lists research_relay), and “Use no outside services” and Incognito turn both off. The research-after-results sub-searches and the planner’s searches are not relayed: they run on chosen engines, which a relay cannot name. Each friend reads the exact words of the searches it is sent.
With overload-relay true (default false), a web search the admission gate sheds goes to the next eligible friend in the same turn instead of the busy page. It respects research’s holds but sets none and leaves the breaker alone, skips a friend whose last X-4got-Relay-Left (within the hour) is 10 or fewer, so research keeps those, waits at most 4 seconds, and at most 2 run at once server-wide. The page shows the friend’s rows, filtered by the person’s engines, labelled “(searched on a friend: this server is busy)”; the SearXNG-shaped JSON (format=json) carries the same words in notice. None of them is cached, prefetched or pushed. With no eligible friend, both slots taken, a failed ask or no rows, the busy page is shown. “Use no outside services” and Incognito turn it off. A search that is not shed is never relayed: to search on another server, search there.
The streamed results (/search/stream, the opt-in progressive results) pass the same admission gate, and a shed web stream goes to a relay friend the same way.
Engines from friends (GET /api/v1/engine-offers)
Friends offer each other the engines they run from engines.kdl. Only the generic blocks travel (settings: an address, selectors or JSON paths), never a Go engine, a plugin or a key.
- The offering friend answers only a friend whose
pubkeyit lists, holding the peer secret, naming itself (X-Peer-Identity) and signing the ask with its identity key:?at=<unix>&sig=<ed25519 over "engine-offers <offering server's fingerprint> <at>">, within 5 minutes. The secret is every friend’s, so a name alone proves nothing. Each block comes signed with the offering server’s identity key, with its own health for that engine (as/api/v1/engine-healthsays it). It never passes on what it took from a friend, nor a block holding a secret of its own or a key: a parameter of its address or body named for one (key, token, secret, auth, pass) with a value, or a credential header. A key written inside an address’s path matches no pattern and is not caught, unless the server itself holds it. - The owner’s Engines from friends page (
/admin/engines/offers, on the Owner console) asks each friend with a pubkey when it opens. It shows each block this server lacks, and each it runs differently as a diff. A block not signed by that friend’s key is dropped. One that cannot be taken says so: its search address is not http(s) or is a private address, another address in it is not http(s), it holds a key, it would ask the sidecar, a local archive or Tor, or it would replace a built-in engine. A keyed block that would send a key to another host than ours of that id asks says that. A name (localhost, a .lan host) is left to the dial guard, which checks where it resolves. - Accept writes the block to
engines.local.d/<friend>-<id>.kdlin the data dir and loads it at once.--check-configand a start read that folder too. A block there replaces engines.kdl’s of the same id. A deploy never writes there. Its engine reaches public addresses only, redirects included. To take one back, delete its file and reload (POST /admin/reloador SIGUSR1). The New engine playground saves there too, asplayground-<id>.kdl: such an engine is not offered to friends (propose it upstream instead). - Ignore keeps the block’s hash in
engines.local.d/ignored, and that block is not shown again. Mute and Unmute post to the Friends page: a muted friend is not asked, and its directory entries are dropped too. - Each engine in engines.local.d has Propose upstream: a new issue on
reference-repo’s tracker (Gitea’s or GitHub’s) with the block in it, opened in your browser for you to send. Nothing is posted by itself.
Questions from friends (GET /api/v1/qa/offer)
Where both servers take questions (the qa block), each lists the other’s open questions and lets the other’s awarded ones answer its searches. One hop: what a friend sent is never offered on. Answering a friend’s question happens on its own server.
- A server offers anyone holding the peer secret what anyone reads of its questions: its open ones (id, title, the opening of its words, when asked, its deadline, how many answers, whether an agent asked) and its awarded ones with the opening of the accepted answer and its evidence, 100 of each, newest first. Never a held question, one hidden by reports, one withdrawn or removed, nor an answer before it is published. The list carries its time and is signed by the server’s identity key (ed25519 over
"4got-sign|v1|questions\n"and the list). Anyone else, and any asker where questions are off, gets 404. - Each friend’s list is fetched when a page needs it (/questions, a search’s card, MCP’s
questions) from each friend trusted on the Friends page whosepubkeypeers.kdl lists, and kept 5 minutes from when it arrives, then fetched again; a friend slow to answer holds up no other. A page waits at most 2 seconds in all and shows the lists that have arrived; a search’s card waits for none, and reads only the lists already kept. Nothing older than the 5 minutes is shown, so a question a friend removes or reports hide leaves within them. A list past 1 MB, not signed by that key, or more than 5 minutes from this server’s clock, is dropped whole. Each question is read as a post here is: one whose id is not one, whose title is empty or holds a control character, whose page there is not an http(s) address, or that was asked, or awarded, after its list’s time is refused; a title is cut to 200 characters and the words to their opening; an evidence link not http(s) is dropped; at most 100 open and 100 awarded are taken. - /questions lists each friend’s open questions under “On
· ”, after this server’s own, each linking to its page there. A friend’s awarded questions are matched against a search here by the same rule as this server’s (at least two of its words, and half of them), then judged by the classifier as this server’s are, so a search’s words never go to a friend; among those holding as many of its words, this server’s come first. The card says “Answered on ” and links there, and MCP’s search line says so too. A friend muted on the Friends page is left out at once and not asked again; a blocked one is never asked.
Instance discovery
The ami4got endpoint
Every 4got instance exposes GET /ami4got (inspired by 4get’s /ami4get.php). This returns a JSON object with instance metadata:
{
"status": "ok",
"service": "4got",
"server": {
"name": "search.example.org",
"description": "Glen's server in Lansing; ask me on Matrix for a friend link",
"open_to_connecting": true,
"bot_protection": true,
"real_searches": 6789,
"bot_requests": 120,
"api_enabled": true,
"version": "2.0",
"pressure": 0.12,
"shedding": false
},
"protocol_version": "1.1",
"capabilities": ["cache_share", "cache_push", "proxy", "trending", "consensus", "research", "relay"],
"instances": ["https://search.friend.example.com"]
}
description is the operator’s server-bio (one line, at most 280 characters; “4got metasearch engine” when unset), and open_to_connecting their open-to-connecting true: this server welcomes new friends.
Instance browser
The /instances page shows a list of known 4got instances. It fetches info from configured friends and public instances periodically.
Each list is nearest first: “From here” is how long this server’s last ask of each took. A server near this one is likely near the person reading the page, so the top of each list is the one to try first. Servers that did not answer come after, then the blocked.
Configure in instances.kdl:
fetch-interval-min 60
friends {
instance "https://search.friend.example.com"
}
public {
instance "https://public.4got.example.com"
}
Friend-of-friend discovery
When Instance A fetches /ami4got from Instance B, it can discover Instance B’s own friends. This creates an organic network where adding a single friend connection transitively discovers the broader network.
Setting up two instances as friends
Step 1: Choose a shared secret
Both instances need the same peer-secret in their config.kdl:
peer-secret "a_strong_random_string_shared_between_friends"
Step 2: Configure peers on each instance
On Instance A (data/peers.kdl):
allow-proxy "translation" "wolfram"
peer "instance-b" {
url "https://search-b.example.com"
}
On Instance B (data/peers.kdl):
allow-proxy "translation" "wolfram"
peer "instance-a" {
url "https://search-a.example.com"
}
Step 3: Add to instance browser (optional)
On both instances, add each other to instances.kdl:
friends {
instance "https://search-b.example.com"
}
Step 4: Test
- Restart both instances
- Search on Instance A — check the logs for “cached on 1 friend” in the results
- Visit
/admin/logto see engine stats (friend results appear as(friend)entries)
Step 5: Optional mTLS
For additional security, configure mutual TLS between friends:
peer "instance-b" {
url "https://search-b.example.com"
cert "/path/to/client.crt"
key "/path/to/client.key"
}
Both instances need to trust each other’s client certificates.
Discovery Channel federation
Peer instances can advertise their Discovery Channel entries to each other, so
a channel is a network rather than one operator’s bookmark file. Entries learned
from a peer appear on /discovery under that peer’s name and in search results
tagged via <peer> — never merged into your own channel file, and never
presented as yours.
What leaves your instance. Only entries you explicitly mark federate=true,
and even then three categories are withheld unconditionally:
| withheld | why |
|---|---|
entries with user/pass | a shared credential is between you and the people you gave it to |
entries with groups=… | scoped to your groups, which have no meaning on someone else’s server |
the contact field | a point of contact is for your channel’s members, not every peer-of-a-peer |
entries with join=… or cert=… | a meshnet invite or a client certificate is a bearer token — anyone who reads it can get in, so broadcasting one hands access to strangers |
/api/v1/discovery/advertise requires peer authorization, so the list of what
you share is not public.
What arrives. Peers are polled hourly (30s after startup), each response capped at 1 MB and 500 entries. The federated set is REPLACED on each refresh rather than merged, so an entry a peer retracts actually disappears from your instance instead of living forever. Peer entries are shown only to cookie-holders — the same gate as your local channel.
Entry liveness
Entries marked check-uptime=true are probed every 6 hours and show up or
unreachable on /discovery and in search results. The channel points at
self-hosted services and private hosts, which disappear far more often than
indexed web pages — an entry that quietly rotted wastes the reader’s click.
Two deliberate constraints:
- The server probes, not the browser. A client-side check would have every visitor connect to every private host in the channel — a phonebook behaving like a port scan, and leaking each reader’s IP to every operator listed.
- Opt-in, HEAD only, no redirects followed, 250 ms apart. Somebody’s home server shouldn’t be pinged because a friend listed it, and a burst of connections from one IP to a list of private hosts is indistinguishable from scanning.
401 and 403 count as up: for a channel full of auth-walled services,
an auth wall is the door existing and being locked, which is exactly what the
entry promised. Only 5xx and connection failures count as unreachable. An
entry with no badge means unknown — either it didn’t opt in, or no check has
run yet.
The webring
Entries marked webring=true form this server’s public webring: /ring lists them for anyone, with or without a cookie, and each member can paste a badge on its own pages (the code is beside it on /discovery):
<nav aria-label="search.example webring"><a href="https://search.example/ring/prev?from=1a2b3c4d" rel="prev" referrerpolicy="no-referrer">← prev</a> · <a href="https://search.example/ring" referrerpolicy="no-referrer">search.example webring</a> · <a href="https://search.example/ring/random?from=1a2b3c4d" referrerpolicy="no-referrer">random</a> · <a href="https://search.example/ring/next?from=1a2b3c4d" rel="next" referrerpolicy="no-referrer">next →</a></nav>
- The badge loads nothing from your server. It is links only, with no image, script or style sheet, so a page view costs you nothing and tells you nothing. A visitor’s browser asks only when they follow one, and the link doesn’t send the page’s address.
- A hop keeps nothing.
/ring/next,/ring/prevand/ring/randomredirect to the chosen member, wrapping around the ends, and the redirect carriesReferrer-Policy: no-referrer, so the next site isn’t told which member sent the visitor.fromis the first 8 hex digits of the sha256 of the member’s address, so reorderingdiscovery.kdldoesn’t break a badge already pasted. When the member has left, the walk starts at the ring’s ends. - Joining is public. The flag is ignored for the same entries federation withholds (
groups,user/pass,join,cert), and a member’scontactis never shown on/ring. - Friends share one ring. Each server advertises its own members to its friends, marked as ring members (with or without
federate=true: they are public already), and a friend’s members join your ring after your own, once per address, marked “via” that friend on/ring. A member’s id is the same on every server, so a badge pasted for any friend’s ring walks yours too. It is one hop: a friend’s members are never advertised on, and a muted or blocked friend’s never arrive.
Doors
A door lets the people a friend’s 4got vouches for into a web service of yours (a wiki, Kiwix, a file index, a bookmark manager’s web page), each under a name only your service sees, as many as you allow that friend. It replaces a Discovery entry’s shared user/pass for a web service. Alex, 2026-10-02: “the server using a friends lended service would be responsible for controlling the group that can use it, and the friend lending it would merely have various levels of rate limiting that they use to protect themselves.”
How a person comes in:
- They open the service’s entry in their own 4got’s Discovery Channel. Its link is
/door/go, which checks that the entry is shown to their group, signs a pass with their server’s key and sends them tohttps://<the service>/.4got/enter. The entry must be an https address, so a pass never travels in the clear. - The door checks the pass against that friend’s key, offline: signed by a friend it names, addressed to this door, at most two minutes old, never used before, and not from before the door started. It sets its own cookie (Secure, HttpOnly) for 12 hours and sends them on into the service.
- Before each request, the reverse proxy asks the door (forward auth). It answers 200 with
Remote-User: alice-1a2b3c4d5e6f7a8b(the friend’s name and the person’s name for this door),Remote-Namethe same andRemote-Groups: alice, or “come in through your 4got”. When the cookie lapses, the next page load goes back through the person’s 4got for a fresh pass, with no click; someone who has left the group there is refused there. The door tells that 4got only the service’s address: it keeps the page the person was on in a cookie of its own for those five minutes.
A person’s name for a door is made from their identity on their own 4got, so that identity has to last from one visit to the next. /door/go keeps it (as History or a bookmark does) only on the person’s own press: the Discovery link, pressed on their 4got. Someone who keeps nothing there and is sent to /door/go by another site is asked first (“Go in to Glen’s films?”), and nothing is kept unless they press Go in.
For a minute after it starts, a door takes no pass: it has forgotten which passes were used before, and a friend’s clock may run up to a minute fast. A person who meets that reads “The door to Glen’s films has just restarted”. A friend’s pass that arrives outside its two minutes is refused as out of date, and the owner’s /door then says how far off it was: the two servers’ clocks may disagree.
A pass carries the person’s server’s fingerprint, the door’s, the person’s name for this door (an HMAC under their server’s key of the door and their identity, so two doors cannot tell they share a person, and neither can link them to their identity at home), its expiry and a nonce. Never the cookie, its hash, the group or a search. Their server keeps only a count of passes by outcome (fgot_door_passes_total).
Setting up a door
The door runs beside the service: the 4got already there, or 4got --door, which runs the door alone (no search, nothing fetched) from a config.kdl of its own with port, host, owner-secret and the block below. In config.kdl, or door.kdl:
door {
name "Glen's films" // what a refused person reads; the service's host if left out
friend "alice" key="<alice's key>" people=10 url="https://search.alice.example"
}
keyis the friend’s 4got key, from their/doorpage.peopleis how many people that friend may send in any 30 days; without it, no cap. The eleventh reads “Glen’s films is full for alice’s server”. A person counts again after 30 days without coming.urlis the friend’s 4got, where a lapsed cookie goes for a fresh pass. Without it, the person comes in again from their Discovery Channel.- The friend’s name begins the user name of each person they send, so renaming a friend gives their people new names at the service. Their pause, people and refusals are kept under their key, so renaming moves none of those.
A line that cannot mean anything stops the start and fails --check-config, saying what is wrong and in which file. A reload (SIGUSR1) puts a change in effect, or keeps the door as it was if the change is wrong.
The owner’s /door (on the Owner console) shows this server’s key, and per friend: people in the last 30 days, refusals (a count per day; no pass is kept), when one was last seen, and Pause, which shuts the door to that friend’s people at once, those already in included. It lists no one.
4got --door listens where its config says, 127.0.0.1 in the examples here, so its /door is reached from the box itself. From your own computer, forward the port over ssh, then open http://127.0.0.1:8890/admin/login, sign in with the door’s owner-secret, and you are on /door:
ssh -N -L 8890:127.0.0.1:8890 you@the-box
Or give the door a name of its own behind the reverse proxy, open only to you (Caddy):
door.glen.example {
@me remote_ip 203.0.113.7
handle @me {
reverse_proxy 127.0.0.1:8890
}
respond 403
}
On the friend’s 4got, the Discovery entry names the door’s key, from the door’s /door page. It holds no secret, and its address must be https (anything else stops the start):
entry "https://films.glen.example" title="Glen's films" door="<the door's key>" groups="friends"
The reverse proxy
The door answers on Authelia’s forward-auth paths, /api/authz/forward-auth (Caddy, Traefik) and /api/authz/auth-request (nginx), so a snippet written for Authelia needs only its address changed. /.4got/ on the service’s host goes to the door unchecked. Each snippet below drops the Remote-* headers a client sends; the door’s 200 sets every one Authelia’s snippets copy as well. The door here listens on 127.0.0.1:8890 and the service on 8096.
Caddy:
films.glen.example {
handle /.4got/* {
reverse_proxy 127.0.0.1:8890
}
handle {
route {
request_header -Remote-*
forward_auth 127.0.0.1:8890 {
uri /api/authz/forward-auth
copy_headers Remote-User Remote-Groups Remote-Name
}
reverse_proxy 127.0.0.1:8096
}
}
}
Traefik (file provider):
http:
routers:
films:
rule: Host(`films.glen.example`)
middlewares: [no-remote, door]
service: films
films-door:
rule: Host(`films.glen.example`) && PathPrefix(`/.4got/`)
service: door
middlewares:
no-remote:
headers:
customRequestHeaders: {Remote-User: "", Remote-Groups: "", Remote-Name: "", Remote-Email: ""}
door:
forwardAuth:
address: http://127.0.0.1:8890/api/authz/forward-auth
authResponseHeaders: [Remote-User, Remote-Groups, Remote-Name]
services:
door:
loadBalancer: {servers: [{url: "http://127.0.0.1:8890"}]}
films:
loadBalancer: {servers: [{url: "http://127.0.0.1:8096"}]}
nginx:
server {
server_name films.glen.example;
location /.4got/ {
proxy_pass http://127.0.0.1:8890;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
location = /internal/door {
internal;
proxy_pass http://127.0.0.1:8890/api/authz/auth-request;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
}
location / {
auth_request /internal/door;
auth_request_set $user $upstream_http_remote_user;
auth_request_set $groups $upstream_http_remote_groups;
auth_request_set $redirection_url $upstream_http_location;
error_page 401 =302 $redirection_url;
proxy_set_header Remote-User $user;
proxy_set_header Remote-Name $user;
proxy_set_header Remote-Groups $groups;
proxy_set_header Remote-Email "";
proxy_pass http://127.0.0.1:8096;
}
}
Not yet
Later steps of the design, not built: accounts the door makes in Jellyfin (its apps send only a user name and password, so no gate in front of them works), door entries passed on to friends’ friends, paid terms, the door as an OIDC provider, passes even the person’s own server cannot link, and client certificates.