mathieucarbou / ESPAsyncWebServer

Asynchronous HTTP and WebSocket Server Library for ESP32, ESP8266 and RP2040
https://mathieu.carbou.me/ESPAsyncWebServer/
GNU Lesser General Public License v3.0
87 stars 17 forks source link

[BUG] setAuthentication on serveStatic not working from 3.3.x #151

Closed rostwolke closed 3 weeks ago

rostwolke commented 3 weeks ago

Description

First, thanks for the good work! After switching from the me-no-dev version of the repo I noticed that my web ui does not ask me for authentication anymore. The code to reproduce this is simply:

server->serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html").setAuthentication("test", "test");

I checked when the problem occurred for the first time. I switched versions back in arduino and the 3.0.6 is the first one that seems to work again.

Link: See example above.

Board: ESP32-C3 Super Mini

Ethernet adapter used ? No

Stack trace

Should not be necessary since the ESP does not crash.

Additional notes

I noticed that this version of the async webserver supports middleware. I am sure I can fix my problem using middleware. I still wanted to inform you since setAuthentication is still listed in the docs.

mathieucarbou commented 3 weeks ago

Thanks for the bug report! Indeed, I saw a bug which was introduced when adding backward compatibility for middleware support. I will fix now.

mathieucarbou commented 3 weeks ago

A workaround is to use middleware

mathieucarbou commented 3 weeks ago

@rostwolke : can you please try v3.3.22 and let me know ?

rostwolke commented 3 weeks ago

@mathieucarbou Works like a charm. Thanks again and keep up the good work :-)