async-esp-fs-webserver icon indicating copy to clipboard operation
async-esp-fs-webserver copied to clipboard

No custom option when using websocket ?

Open GregAscolab opened this issue 1 year ago • 3 comments

Description :
If I use websocket, /setup page options are not displayed ?

Context :
v1.0.4
ESP32-WROOM

Step to reproduce :

  1. Use "withWebSocket.ino" example without modification :
  • Websocket "/" (root) page : works well displaying time every second.
  • "/setup" page :
    • did not display "My Options" tab in menu ???
    • did not dispaly "ESP Mode", nor "IP address", nor "Firmware"
    • "Loading" footer never ends...

Created config.json :

{
  "param-box1": "My Options",
  "LED Pin": 2,
  "Option 1": "Test option String",
  "Option 2": 1234567890
}
  1. Just comment "/" root page handler, and rebuild
// Add custom page handlers
  // server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
  //   request->send(200, "text/html", homepage);
  // });
  • Then "/" doesn't work (normal ;-) )
  • "/setup" page works : "my option" tab is back...

GregAscolab avatar Jan 12 '24 15:01 GregAscolab

Hi @GregAscolab.

Thanks for pointing out this insidious bug to me. The problem is due to a double // in one of the response to a request made by the /setup page which is interpreted as the request inserted in the sketch / thus causing the page to malfunction.

I just committed the change (I also removed my test WiFi credentials that I use with on of my smartphones from the example :scream:)

cotestatnt avatar Jan 12 '24 17:01 cotestatnt

hmmm same problem for me no display custom addoptions button on setup page when server on activated

arduino libraries say version 1.0.4 wich is the same as here i think

ldijkman avatar Feb 12 '24 03:02 ldijkman

workaround for me now

if i look in the source a page index htm not html wil be served if present if on http://ipadres with or without / http://mdsnsadres.local wit or without /

/home/dld/Arduino/libraries/AsyncEspFsWebserver/src/AsyncFsWebServer.cpp line 61 62 onNotFound( std::bind(&AsyncFsWebServer::notFound, this, _1)); serveStatic("/", *m_filesystem, "/").setDefaultFile("index.htm");

ldijkman avatar Feb 12 '24 16:02 ldijkman