gzip compressed files fail on Windows localhost development and live with Android Firefox
I have three sites I developed using React and Webpack with go web servers, using the following browsers with gzipped files using compression-webpack-plugin I have no problems live or using localhost: Brave: Windows and Android Chrome: Windows and Android Edge: Windows Opera: Windows and Android
But,
Firefox: Windows ===> live works, Android Fails
Firefox: Windows localhost fails
In Dev tools when it fails, I click on vendor.js or bundle.js and get the gzipped output see attached images.
On Android, if you go to https://lib.kaneisdi.com you'll get an empty screen.
When I remove the gzipped files and it uses the js files everything works.
I tried with restart Add-ons disabled.
Thanks
Pierre
Izabrano rješenje
Confirmed - my Firefox can decode it now.
Pročitaj ovaj odgovor u kontekstu 👍 1Svi odgovori (7)
Could you try this change in how vendor.js and bundle.js are served:
Server: nginx
Date: Mon, 25 Sep 2017 20:24:36 GMT
Content-Type: application/gzip => application/javascript
Transfer-Encoding: chunked
Connection: keep-alive
Accept-Ranges: bytes
Content-Encoding: gzip
Last-Modified: Sun, 24 Sep 2017 23:06:07 GMT
Vary: Cookie
Changing that stopped my sites from rendering properly in all browsers.
Remember, it works fine if it's from my server and fails at recognizing gzip compression when it's localhost or on Android.
bigbuckbunny said
Changing that stopped my sites from rendering properly in all browsers.
That's strange.
Remember, it works fine if it's from my server and fails at recognizing gzip compression when it's localhost or on Android.
Not for me: I get a page of gibberish for this in Firefox 55 on Windows 7 (copy/paste to the address bar):
view-source:https://lib.kaneisdi.com/vendor.js
That's where I checked the Network Monitor and discovered the incorrect content type for a .js file.
I've never seen that before. There must be something strange about your server configuration.
The gibberish is the gzip compressed file (which was included with my images) and if there was something wrong with my server why does it work in all the browsers that I listed in my original post.
On windows 10 with Firefox 55 64 bit, when I paste view-source:https://lib.kaneisdi.com/vendor.js
It's clean js, sample copy paste: !function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.ex
7 different browsers have no problems with gzip and my local server is Go running in Gogland and all those browsers work fine.
If it would fail in any of the other browsers, I would have questioned my server setup, but localhost.
I just won't serve gzip on Firefox Android and tell my mobile users that it will be slow to load and give them the other alternatives. I'm not supporting old browsers and everything works the way I want it and I have to move on to publishing.
Thanks for the input.
Pierre
Maybe this is a problem with the server you use and the file might be double gzipped in some cases if you use a file that is already compressed.
Maybe related to this bug report.
- Bug 538971 - [GoAhead-Webs] Sometimes sends broken Content-Type: application/gzip for compressed scripts
RESOLVED
First I need to apologize to jscher2000 for my response, after reviewing it I found a little rude. I got the concussion thingy and was tired.
I saw that in Firefox the content type was x-gzip and in the other browsers it was just gzip and did a search on x-gzip that led to:
https://github.com/shurcooL/httpgzip/issues/1
So I included x-gzip in the content type on the server and everything works in localhost and Android.
It's weird that it worked live though except jscher2000 from what I take on your system it failed and that's why you got the garbage?
If that's the case can you let me know if you see/saw (yeah couldn't help myself) the login page.
Thanks Again
Pierre
Odabrano rješenje
Confirmed - my Firefox can decode it now.