Why GZip Compression Matters
GZip is the standard compression algorithm used to shrink the size of HTTP responses and speed up how fast they’re delivered. Compressing your responses can reduce transfer sizes by 70-90% for text-based content like HTML, CSS, and JavaScript.
Enabling compression improves your application in several ways:
- Faster page load times as smaller files transfer more quickly
- Reduced bandwidth costs from serving less data
- Better Core Web Vitals scores for SEO
- Improved user experience especially on slower connections
- Lower Heroku dyno memory usage from reduced I/O
GZip is universally supported by all modern browsers, making it a risk-free performance optimization.
How GZip Works
When a browser requests a resource, it sends an Accept-Encoding: gzip header indicating it can handle compressed responses. If your server supports compression, it compresses the response and sends it with a Content-Encoding: gzip header. The browser automatically decompresses the content before rendering.
Without Expedited WAF, you would need to configure compression in your application code or web server, adding complexity and CPU overhead to your dynos.
GZip vs Brotli
While GZip is the industry standard, newer algorithms like Brotli offer even better compression ratios (15-25% smaller than GZip).
Expedited WAF automatically negotiates with each connecting browser to choose the best compression algorithm. If the browser supports Brotli, it gets Brotli. Otherwise, it falls back to GZip.
Browser support:
- GZip: 100% of browsers
- Brotli: 97%+ of browsers (all modern versions)
Prerequisites
What you need to get started:
- Expedited WAF add-on installed on your Heroku application
How To Enable GZip Compression on Heroku
Step 1: Open the Performance Settings
Navigate to your Expedited WAF dashboard and select the Site Speed Up page from the sidebar menu.
Step 2: Enable GZip Compression
Toggle on GZip compression. This automatically compresses all compressible responses passing through the WAF.

Step 3: Verify Compression
Test that compression is working using browser developer tools:
- Open your site with DevTools open (Network tab)
- Look for the
Content-Encoding: gzipheader on responses - Compare the transferred size vs actual size to see compression savings
What Gets Compressed
Expedited WAF automatically compresses text-based content types:
- HTML pages
- CSS stylesheets
- JavaScript files
- JSON API responses
- XML data
- SVG images
- Plain text files
Binary files like images (PNG, JPG, GIF) and videos are not compressed, as they’re already compressed and would see no benefit.
Common Use Cases
API Response Optimization
JSON API responses compress extremely well, often 80-90%. Enable GZip to significantly speed up mobile app API calls.
Single Page Applications
SPAs often have large JavaScript bundles. Compression reduces initial bundle download time dramatically.
Content-Heavy Sites
Blogs, documentation sites, and content platforms benefit from compressed HTML and CSS delivery.
International Users
Users on slower international connections see the biggest improvements from compression.
Performance Impact
Typical compression results for common file types:
| File Type | Uncompressed | GZip | Savings |
|---|---|---|---|
| HTML | 100 KB | 20 KB | 80% |
| CSS | 150 KB | 25 KB | 83% |
| JavaScript | 500 KB | 125 KB | 75% |
| JSON | 50 KB | 8 KB | 84% |
Troubleshooting
Issue: Content-Encoding header not present
- Verify the WAF is correctly proxying your traffic
- Check that the content type is compressible (text-based)
- Some CDNs may strip compression headers
Issue: Double compression warnings
- Ensure your application isn’t also compressing responses
- Let Expedited WAF handle compression to avoid overhead
Issue: Compression seems slow
- Large files may take slightly longer to compress
- Enable Brotli for better compression ratios
- Consider pre-compressing static assets
Related Guides
Resources
Learn more about HTTP compression: