I'm using ESP Async WebServer to work with my website on esp32. Im including .gz fike as an array to my code like this:
Code: Select all
#include "web/index.html.gz.h"
Code: Select all
server.on( "/" , HTTP_GET, [](AsyncWebServerRequest *request) {
response(request, index_html_gz , index_html_gz_len , "text/html"); } );
Code: Select all
void response(AsyncWebServerRequest *request, const uint8_t *content,
int length, const char *contentType)
{
// log.debugEx(" response file ").add(request->url()).end();
touched();
AsyncWebServerResponse *response = request->beginResponse_P(
200, contentType, content, length);
response->addHeader("Connection", "close");
response->addHeader("Content-Encoding", "gzip");
request->send(response);
log.debugEx(" sent file ").add(request->url()).end();
}
I tried to put the non-compressed .js file to SPIFFS, but i had the same result. The non-comressed .js file has a huge size (380kb), so maybe this is a problem?
Then I tryed to put comperresed .js file into SPIFFS - but it works weird. Spiffs.bin is ok (I checked it with mkspiffs before uploading and dumped it after uploading), but when I turn on esp and try to list filesystem its empty.
So I spent two weeks trying to fix at least one of this problems, but ...
Hardware esp32-wroom-32
Using platformio
framework = arduino
platform = espressif32
board = esp32dev