Gzip encoding for 404 document in static website hosting
I am hosting a vue SPA through static website hosting feature offered by Azure Blob storage. My files are gzip encoded and I add the respective header value when uploading. The site works fine!
However, When I try to manually hit a URL (say, xyz.com/fgt) or an invalid URL (say, xyz.com/errorpage), it serves me the gzip gibberish instead of an HTML file. This is a behavior that you see when "Content-encoding: gzip" is not added to your HTML file but I do during my deployment. That's how I am able to see my site in the first place. However, if I don't encode with gzip during the build and don't add the header during the deployment, the site works fine. All the error pages are properly routes and manually hitting a URL returns the proper page. My guess is when it serves the error document (I have configured the index.html as error document), it removes the header or doesn't recoginize gzip as an encoding. This is crucial for a SPA that compresses it's file.
Lingfan Gao commented
FTE here: I have the same issue with 404.html, it seems that any other page the content-encoding header is sent correctly but not the 404 document