Hi,
I've recently moved some code from the NodeMCU environment to the ESP32 environment and I've found something very odd with the WebServer code. I've refreshed my sources from today and it still fails.
I have an index.html file stored in SPIFFS that contains the header:
<link rel="stylesheet" type="text/css" href="styles.css" media="all" />
<script type="text/javascript" src="jquery-3.2.1.min.js"></script>
The server code makes use of the standard pattern:
server.onNotFound([]() {
// Try to send the file requested
if (!handleFileRead(server.uri())) {
// We have not located the file, return not found.
server.send(404, "text/plain", "404: Not Found");
}
});
and the handlerFileRead method starts with:
bool handleFileRead(String path) {
// A request has come in for a file, we can process that here.
Serial.println("");
Serial.println("File requested:" + path);
This all seems to work fine, the index.html file is served as expected and the styles.css file is severed as expected. The jquery-3.2.1.min.js request is never server when requested via the index.html page? Seemingly the request never gets as far as the handlerFileRead method.
However, if I request the jquery-3.2.1.min.js file directly then it works.
It's almost as if it can't handle all the requests from the index.html page. Using Chrome to try and debug this I can see the request going out correctly from index.html but Chrome shows no response?
I wonder if anyone else has similar issues. This worked fine on the NodeMCU device.
The attachment can demonstrate this failure.
Any help / guidance much appreciated.
Martin
WebServer not seeing all requests!
-
- Posts: 3
- Joined: Wed Nov 14, 2018 12:35 pm
WebServer not seeing all requests!
- Attachments
-
- ESP32Failure.zip
- (34.01 KiB) Downloaded 348 times
Who is online
Users browsing this forum: jesper and 52 guests