Warm tip: This article is reproduced from serverfault.com, please click

How to configure tomcat to serve precompressed static files?

发布于 2020-12-13 04:51:48

Under nginx I know a option:

gzip_static on;

which allows to access the precompressed gzip file with the same name, for example, if I have a file /var/www/style.css.gz, when request http://localhost/style.css with header ' Accept-Encoding:gzip the server will return the file on disk style.css.gz as style.css.

How can I do the same under Tomcat?

Questioner
Yu Jiaao
Viewed
0
Christopher Schultz 2020-12-20 05:39:39

Tomcat doesn't have this feature.

You could write a servlet/filter/etc. that can do it if you'd like.