feat: implement captive portal redirects for auto-loading the management page on hotspot mode (#2550)

This commit is contained in:
Jacob Latonis
2026-07-13 00:10:23 -04:00
committed by GitHub
parent 3a97f3e63e
commit 73ab9ab20d
+9
View File
@@ -353,6 +353,15 @@ void CrossPointWebServer::handleJszip() const {
}
void CrossPointWebServer::handleNotFound() const {
// in AP mode, redirect unmatched browser/captive-portal requests to "/" so the OS auto-opens the browser
// API requests (/api/*) still return 404 so XHR errors surface correctly
// see https://en.wikipedia.org/wiki/Captive_portal#Detection
if (apMode && !server->uri().startsWith("/api/")) {
server->sendHeader("Location", "/", true);
server->send(302, "text/plain", "");
return;
}
String message = "404 Not Found\n\n";
message += "URI: " + server->uri() + "\n";
server->send(404, "text/plain", message);