tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [URGENT] Content-Encoding: gzip not set
Date Mon, 09 Mar 2015 21:33:11 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Victor,

On 3/9/15 3:12 PM, Victor Rodriguez wrote:
> I have some ALREADY gzipped files that I'm trying to serve up.

See Mark's reply for how to do what you are trying to do. I'd like to
comment, here, though.

> I have the following in my web.xml.
> 
> <mime-mapping> <extension>json</extension> 
> <mime-type>application/gzip</mime-type> </mime-mapping>
> 
> And, I have the following in my server.xml:
> 
> <Context docBase="/path/to/already-gzipped-json"
> path="/already-gzipped-json" />
> 
> From the command line, I can curl the files and gunzip them just
> fine, so they are coming across gzipped:
> 
> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip
> -
> 
> However, requests coming from a web browser aren't handled
> correctly and aren't legible in the browser, and I believe it's
> because Content-Encoding: gzip is not in the response headers.

Nor should it be: the file is a gzipped file; it's not being sent in
"gzip" encoding. You are confusing the two concepts.

If you request a web resource, what you get is what's on the server's
disk. If that content is gzipped, you'll get a gzipped file. If it's
not, you don't.

Content-Encoding: gzip means that the original file is being
compressed for transit, but that the original file is not
(necessarily) in gzipped format.

> curl -I http://localhost:8082/already-gzipped-json/fie.json
> 
> HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Accept-Ranges: bytes 
> Last-Modified: Mon, 09 Mar 2015 17:15:29 GMT Content-Type:
> application/gzip Content-Length: 17905 Date: Mon, 09 Mar 2015
> 19:11:06 GMT
> 
> How do I tell Tomcat to include the Content-Encoding: gzip
> response header?  Again, these area ALREADY zipped files.  I'm not
> interested in Tomcat doing the gziping on the fly.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU/hGXAAoJEBzwKT+lPKRY5JIP/iP0JhQXUeYqc36vwPIBfd8I
gIF59ZaSYzEifUFSTDGNe9YBhBtctVgpl+EB2RPIq3ICbC88SQhdaIFAqm+jyv9t
WpY62P+ZF5oRB36agYiGZl897KcC5nVvXVJ3wW3wkdT9jjRqtquV0idIdXEEjtCX
UUloa6YBqxz0LtrRzQYI4jGlK/sVGE9i1OraTJ5LbkDbE8KC7wtEB3/s6ptXRalr
VnTc1bofc/9HrlXKBqghr9Z13PXPLSXuJ5dih4TSO8rBQyw4J/rQD8lD/LPprxXB
BKNEUNCTWMuGjXtisDrcMkPPiNZTcFMuYbLDtzift7i2RGPbPuLLKt6ZiytncCjs
+EG6xkh2NRJVydUqQreIA+1n4ToLNApbI5+xt6FcIlEoftHrnrNA2vel2rUICj+n
Em/Eavt6L2IzkVUXOwWWjpVyqG0NXAJseL08itoMuKzTZZvXAtObc+EtL/zQzUaU
fC3Fz68U9HcQj6Zc7NmzHNihjOlb/wCswI32iuV0LZa4mN0qi3HCFEREOx4ijlnZ
/B/E+EWCZl4beICSAO6QFpWCHNm0m2FVKglD5vSLprxOwSqnTk0UR/WHf3aVWv97
GAx0iDrDtvZJRBnyVrdx0nD99hJBsDyYXl4KzMx/8m/yyuH4mTDLGnNqMjPpT1xT
d0l9sHubJaWratZJ9d1T
=flBL
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message