How to use gzip compression on my Clojure app?

Like many single-page applications there are several sizable payloads involved in my Clojure apps: the initial app.js, MBs worth of data for populating pages, etc. I want to use gzip compression in my (Leiningen, Ring) app and wonder what your best solutions have been. A promising approach was Adding Gzip compression to a Clojure webapp in 30 seconds from Cemerick, but this post is over 9 years old and the solution – “just use web.xml in Jetty” – leaves me struggling to figure out how to even get a web.xml in my project. Now, I could look into using mod_deflate in my apache reverse-proxy, but I’d rather have this included in the app both for verisimilitude and portability.

If you recommend just using a web.xml, how do you set it up? Or if you have a different solution, I’d love to hear it. Thanks!

Hi, we use this approach:

1 Like