Brotli support #42
Replies: 2 comments
-
Brotli support can be done with your own handlers. See examples in the ESP-dASH: https://github.com/ayushsharma82/WebSerial/blob/master/src/WebSerial.cpp
This is implemented since years already. Sadly it only available for https. You can read the reason on a discussion in the Chromium group - mainly due to how proxy work and re-gzip data and overwrite the content encoding, losing the information that it was brotli-encoded.
Brotli is not available on Chromium (Edge, Chrome, etc) and Firefox over http. Only Safari allows it. So it is only OK to use it if your device uses https (and ESPAsyncWebServer cannot do https on ESP32). So what's the point...
It is because it is used in cases for static content like images, sounds, scripts, etc and the content type is known from the browser or can be set by the browser. These handlers are not to be used for REST API or dynamically consumed data. |
Beta Was this translation helpful? Give feedback.
-
I would add to this that you can use zopfli to compress you files to gz, it gives a bit better compression than native gzip. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In
WebHandlers.cpp
, the methodbool AsyncStaticWebHandler::_fileExists
implements looking for gzip files.I would love to see it extended to also look for brotli files, as this is the emerging future standard, which also is more efficient than gzip - that is very good for use in embedded devices of course.
Also, I cannot see the
AsyncStaticWebHandler
setting a content type depending on the original file extension - is this something to improve as well?Beta Was this translation helpful? Give feedback.
All reactions