Legacy Knowledge Base
Published Sep. 10, 2025

Is there an out-of-the-box way to set up gzip compression for only specific endpoints?

Written By

Kenny Back

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • The gzip filter is disabled by default, but I enabled it using:

com.liferay.portal.servlet.filters.gzip.GZipFilter=true
  • After enabling it, I tried accessing an image guest URL via Postman, but I noticed that the header response does not include Content-Encoding: gzip. Since our images are large, we aim to compress them in the HTTP response so have exposed a GraphQL API via RestBuilder and want to know if we can apply a gzip filter to the API as an approach to improve performance?

Environment

  • DXP 7.4

Resolution

  • Liferay has no out-of-the-box way to set up gzip compression for only specific endpoints, if you enable gzip compression, Liferay will compress everything, including API communication, if the receiving client supports gzip compression.
  • We recommend setting up gzip compression for optimal performance on the web server, not in Liferay. The web server will yield better performance compared to Liferay since the compression algorithm is compiled on the web server while in the app server it is interpreted. Also tiers sitting in front of the app server, whether they are a web server, a CDN, or a caching layer, may uncompress the response as part of their handling of the content. Enabling gzip in the app server then can slow response times because of this extra effort.

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base