Make redirection of all 'not found' URLs a configuration option
ncmreynolds opened this issue · comments
Similar to discussion in issue #25 "Captive portal" I am trying to use ESPUI in a situation where I would like it to be hard for a user to fail to hit the page.
My suggestion is to make a configuration method to change the handling of 404 errors by ESPUI so OPTIONALLY they redirect to /
I have done this myself by replacing line 1135 of ESPUI.cpp...
server->onNotFound([](AsyncWebServerRequest* request) { request->send(404); });
with...
server->onNotFound([](AsyncWebServerRequest* request) { request->redirect("/"); });
but this is obviously a one-off hack, ideally it should be optionally set using a new method.
If you like this idea I might look at doing a pull request for it myself. It seems to help with the ESPUI interface being brought up automatically in captive portal type situations.
Great, yes PRs are welcome