Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Static gzip content in DefaultServlet, firefox problems

So replying to myself after a long time looking for a solution.

The issue here is that Firefox needs a registered mime type for the file to actually interpret it as a decompressed file. In my case it was a chemical file (mime type chemical/x-cif, the content is actually just plain text). If the file being served with compression does not have a known mime type, then the file will appear as "application/gzip" and Firefox then refuses to treat is as decompressed and instead shows the uncompressed binary stream.

Funnily enough all other browsers I tested (Chrome and IE) don't have this behaviour: they will just show as uncompressed any file, whatever its mime type.

So in the end the solution was adding the mime type to my etc/webdefault.xml (in <mime-mapping> tag).

Hope this is useful for someone

Jose



On 22.06.2015 18:36, Jose Manuel Duarte wrote:
I am having trouble with the gzip feature for static content in jetty DefaultServlet. I am running jetty 9.2.11.

Basically I turned the option on in etc/webdefaults.xml (setting gzip=true) and then try it out pointing my browser to:

http://myserver/static/path/my.file.txt

In the server's file system what I have is "static/path/my.file.txt.gz". Following the docs, what I should get is the uncompressed text file "my.file.txt". That in fact happens correctly in Chrome (tested in version 43.0.2357.125 in Linux) and IE 11. But in Firefox (tested in version 38 in Linux), what I get is the file "my.file.txt" but still gzipped-compressed.

Any ideas what can I be doing wrong? Is there any known issue with this feature in Firefox?

Thanks a lot for the help

Jose



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top