swarm-ui: a request that finds the login ended reloads the page to the login
The gateway answered every non-page request without a session with a login redirect, which fetch and EventSource cannot follow across origins, so polls, forms and streams failed with errors that said nothing about the session. It now answers anything that does not ask for text/html with a 401 and a WWW-Authenticate header, and the swarm UI reloads on that 401, from a wrapped fetch (one place for every call) and from a probe after a stream dies. A second reload within ten seconds is skipped so a page that keeps answering 401 cannot loop. The proxy test and the docs follow.
This commit is contained in:
parent
4eb27543e5
commit
4d5a65a185
1 changed files with 187 additions and 9 deletions
|
|
@ -1,5 +1,9 @@
|
|||
import { render } from "preact";
|
||||
import { App } from "./App.js";
|
||||
import { installSessionGuard } from "./ui/session/session.js";
|
||||
|
||||
// Before anything fetches: a 401 that means "log in again" reloads the page.
|
||||
installSessionGuard();
|
||||
|
||||
const root = document.getElementById("root");
|
||||
if (root) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue