.htaccess 'AddEncoding br' - fail on file download

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

.htaccess 'AddEncoding br' - fail on file download

Postby kamilk » 14. June 2020 19:15

Setup
I install no my MacOs HighSierra fresh XAMPP osx-7.4.6-0-vm (https://www.apachefriends.org/index.html) and start it
Image
- server runs on IP 192.168.64.2 . Then I mount `/opt/lampp`
Image
and click to `Explore`. The Finder window open and I go to directory `htdocs/`. Then inside `htdocs` I create folder `assets` and inside it I copy file `alice.wasm` (this file is compressed using brotli (br) (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding)). You can download this test (brotli compressed) file using this jsfiddle generator https://jsfiddle.net/Lamik/f1nr459g/ . Inside `htdocs` I create following `.htaccess` file

Code: Select all
    <IfModule mod_mime.c>
      AddType application/wasm .wasm
      AddEncoding br .wasm
      AddOutputFilterByType DEFLATE application/wasm
    </IfModule>


Problem
When I go to http://192.168.64.2/assets/alice.wasm browser not download file and in chrome>networks tab I see

> (failed) net::ERR_CONTENT_DECODING_FAILED

Image
(and here are more details https://imgur.com/a/VzuRQIg)

However, when I change `AddEncoding br .wasm` to `AddEncoding rar .wasm` (or instead 'br' I use `zip`, or `none`) then browser download file (!!!) ( details https://imgur.com/a/3u6MAiF) but the problem is that browser automatically NOT decompress file (so it save compressed file).

When I put this `.htaccess` file and `alice.wasm` file to some AZURE apache-like server (but I don't have access to it configuration files) then browser download file and decompress it on the fly - so this is POSSIBLE.
Image

Question: What I should do to make XAMPP working as expected (allow browser to download alice.wasm decompress it on the fly and save on user disc) ?
kamilk
 
Posts: 2
Joined: 14. June 2020 18:49
XAMPP version: 7.4.6
Operating System: MacOs High Sierra

Re: .htaccess 'AddEncoding br' - fail on file download

Postby kamilk » 15. June 2020 14:32

It is very strange, but when I enable port forwarding

Image

And go to http://localhost:8080/assets/alice.wasm then Chrome download file and automatically decompress it (exactly what I want). AZURE works on HTTPS and file was downloaded properly probably because brotli compression is support only for HTTPS (https://security.stackexchange.com/questions/150351/brotli-compression-for-https) - however probably on Chrome localhost is 'special' and allows it too:

Image
kamilk
 
Posts: 2
Joined: 14. June 2020 18:49
XAMPP version: 7.4.6
Operating System: MacOs High Sierra


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 58 guests