For example, my 'data' folder has two files:
1. favicon.ico
2. index.html
I compress index.html to index.html.gz.
With this code, .gz archive is opening in a browser as plain text, showing a couple lines of jibberish:
Code: Select all
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
AsyncWebServerResponse *response = request->beginResponse(200, "text/html");
response->addHeader("Content-Encoding", "gzip");
request->send(SPIFFS, "/index.html.gz", "text/html", false);
});
Code: Select all
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
AsyncWebServerResponse *response = request->beginResponse(200, "text/html");
response->addHeader("Content-Encoding", "text/html");
request->send(SPIFFS, "/index.html.gz", "text/html", false);
});