Alloy
v0.1
Redirects and history
Redirect::to(url)andBackanswer303. A302answer to an InertiaPUT,PATCHorDELETEbecomes303. A redirect to a URL with a#fragmentbecomes409withX-Inertia-Redirect, and an empty200becomes a redirect back.alloy::location(url)leaves the app with a full page load (OAuth, a download, another site):409withX-Inertia-Locationfor Inertia visits,303otherwise. Pass only URLs the app chose, never user input.- An Inertia
GETof a Mold page (the Watchfire dashboard) gets409X-Inertia-Location: a full page load. X-Inertia-Locationfor the request itself and the page'surlhold the request's path and query starting with exactly one/: leading slashes and backslashes become one/(//evil.example/xbecomes/evil.example/x), so the client never resolves them to another site.alloy::clear_history(&session)setsclearHistoryon the next page; the kits call it on logout.- The browser keeps every page's props in its history. With
.encrypt_history()(on theAlloybuilder, or.encrypt_history(true)on a page) the client encrypts them with a key it drops onclearHistory, so the back button cannot show a signed-in page after logout. The client encrypts only in a secure context: over HTTPS, or on127.0.0.1/localhost; elsewhere it keeps the history unencrypted and logs a warning in the browser console. The kits with authentication turn it on.