Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

redirects: Accept= condition, and Vary for conditional rules #92

Merged nekomimi.pet
targeting main from feat/redirects-accept-condition
Merged opened by and assigned to nekomimi.pet
targeting main from feat/redirects-accept-condition

Adds an Accept= condition to _redirects, next to Language=, Country= and Cookie=, for serving a different representation of the same path:

/    /index.json    200!  Accept=application/json,application/ld+json

A rule matches when the request's Accept header names one of its media types with a non-zero q. A rule value such as text/* matches any subtype. Wildcards in the request never match, so the */* that every browser sends keeps getting the HTML page, while a client asking for application/json by name gets the JSON. wispctl's local matcher (wispplace-core) follows the same rule.

Site responses are cached as public, max-age=600, so a negotiated answer without Vary could be replayed for the other representation. The matcher now reports which request headers the conditions on path-matching rules read (Accept, Accept-Language, Cookie), whether or not a rule matched, and the hosting service adds them to Vary. Existing Language= and Cookie= rules never set Vary; they now do.

Tests: fs-utils matcher cases (named types, type/*, wildcards, q=0, missing header, Vary reporting), a hosting integration test checking both answers and their Vary, and the Rust matcher. Removing the condition or the Vary step fails them. Root suite 2162 pass; tsc, biome and cargo clippy clean. Docs updated in docs/.../redirects.md.

Commits 0