I'm using https://github.com/peterldowns/localias for local development. If I attempt to load the app while cargo watch is recompiling and rerunning the app, Caddy (as part of localias) immediately responds with a 502 error.
the .catch doesn't fire if a HTTP response is received, even though it's a HTTP error 502. This causes the snippet to immediately reload into the 502 error page instead.
I hacked this together as a manually injected snippet which works in my scenario:
fetch(url, {{ cache: "no-store", signal: controller.signal }})
.then((resp) => {
if (!resp.ok) {
throw new Error("Failed to load endpoint");
}
console.log("[tower-livereload] reload...");
window.location.reload();
})
.catch((err) => setTimeout(() => retry(url), {reload_interval}));
I'm using https://github.com/peterldowns/localias for local development. If I attempt to load the app while
cargo watch
is recompiling and rerunning the app, Caddy (as part of localias) immediately responds with a 502 error.In the snippet:
the
.catch
doesn't fire if a HTTP response is received, even though it's a HTTP error 502. This causes the snippet to immediately reload into the 502 error page instead.I hacked this together as a manually injected snippet which works in my scenario: