Closed sweharris closed 2 years ago
Aha, interesting, I've never seen that behavior but good to know! I'll add the signature strategy to the next release, so that we don't have a pitfall waiting anyone on RedHat 🙂
Hi @sweharris 👋
Support for server-handled gzip has been released in Pagefind v0.5.0 🎉
If
mod_mime_magic
is enabled on an Apache server (it's enabled by default on RedHat based systems) then the pf_meta file fails to load.Looking deeper into this, it appears as if the magic module is detecting the files are already gzip'd and so added a
Content-Encoding: x-gzip
header to the response. This appears to tell the browser to automatically gunzip the data becausegzs()
is being passed the uncompressed data. This, naturally then fails the "is this compressed" test and causes the load to fail.The simple solution is to disable this module on the server (which may be worth adding to the documentation). But maybe having some way of detecting if the browser has automatically uncompressed the data before the javascript gets to see it (e.g. add a simple 3-byte signature to each file; if that gets seen instead of the gzip header then return the raw datastream).