This library is a wrapper around the TLS-enabled web server for the ESP32 using the Arduino core, to make it compatible with the default Webserver API.
The setup depends on the IDE that you're using.
If you're using PlatformIO, just add esp32\_https\_server\_compat
to the library depenendencies in your platform.ini
:
[env:myenv]
lib_deps = esp32_https_server_compat
Download this library from the releases tab on GitHub and put it into the libraries
folder of your Arduino installation. In addition, you need the underlying esp32_https_server
library. Download the same version from that repository's releases tab and also put it into the libraries
folder besides the previously downloaded library. Restart your IDE if it is currently running.
The library can be used in the same way as the default WebServer library, with the only difference that you need to include ESPWebServer.hpp
instead of WebServer.h
:
#include <ESPWebServer.hpp>
ESPWebserver server(80);
void setup() {
server.begin();
}
void loop() {
server.handleClient();
}
To use the HTTPS server use <ESPWebServerSecure.hpp>
and ESPWebServerSecure
in stead of ESPWebServer
.
More information and examples can be found in the default WebServer's repository. There are two minimal examples (more test programs, really) in the examples directory.
The following issues are known:
serveStatic()
will serve only a single file or a single directory (as opposed to serving a whole subtree in the default WebServer).serveStatic()
does not implement automatic gzip support.serveStatic()
knows about only a limited set of mimetypes for file extensions.authenticate()
andrequestAuthentication()
handle onlyBasic
authentication, notDigest
authentication.sendHeader()
ignores thefirst=true
parameter.collectHeaders()
is not implemented.- Handling of
POST
forms with mimetypeapplication/x-www-form-urlencoded
is memory-inefficient: the whole POST body is loaded into memory twice.