[PR #4774] Enable HTTP response compression for API and static assets #4344

Open
opened 2026-04-25 00:19:22 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4774
Author: @lcharlick
Created: 10/25/2025
Status: 🔄 Open

Base: masterHead: compression-middleware


📝 Commits (1)

  • e8120eb Enable HTTP response compression

📊 Changes

3 files changed (+50 additions, -0 deletions)

View changed files

📝 package-lock.json (+45 -0)
📝 package.json (+1 -0)
📝 server/Server.js (+4 -0)

📄 Description

Brief summary

This introduces response compression using Express’s compression middleware.

Which issue is fixed?

N/A

In-depth Description

A response is only compressed if:

  • Client sends Accept-Encoding: gzip (or br, or both)
  • Response type is compressible (e.g. application/json, not image/jpeg)
  • Response size is > 1kb (this is the library default, but I thought it better to be explicit)

Note that this also compresses static js/etc files served for the web app, not just API requests.

How have you tested this?

Manual testing by directly hitting the API and navigating around the web/mobile apps.

Some unscientific before/after numbers:

UI Page Loads

View Uncompressed Compressed Reduction
Home tab 2.15 MB 1.42 MB 34% smaller
Library tab 2.43 MB 1.74 MB 28% smaller

API Endpoints

Endpoint Page Size Uncompressed Compressed Reduction
/api/libraries/<id>/items 50 130 KB 41 KB 68% smaller
/api/items/<id> - 22 KB 3 KB 86% smaller

Screenshots

N/A


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4774 **Author:** [@lcharlick](https://github.com/lcharlick) **Created:** 10/25/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `compression-middleware` --- ### 📝 Commits (1) - [`e8120eb`](https://github.com/advplyr/audiobookshelf/commit/e8120eb64503f483bd514e7c1a11d5f1f01b70b9) Enable HTTP response compression ### 📊 Changes **3 files changed** (+50 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `package-lock.json` (+45 -0) 📝 `package.json` (+1 -0) 📝 `server/Server.js` (+4 -0) </details> ### 📄 Description ## Brief summary This introduces response compression using Express’s [compression](https://www.npmjs.com/package/compression) middleware. ## Which issue is fixed? N/A ## In-depth Description A response is only compressed if: - Client sends Accept-Encoding: gzip (or br, or both) - Response type is compressible (e.g. application/json, not image/jpeg) - Response size is > 1kb (this is the library default, but I thought it better to be explicit) Note that this also compresses static js/etc files served for the web app, not just API requests. ## How have you tested this? Manual testing by directly hitting the API and navigating around the web/mobile apps. Some unscientific before/after numbers: ### UI Page Loads | View | Uncompressed | Compressed | Reduction | |------|---------------|-------------|------------| | Home tab | 2.15 MB | 1.42 MB | 34% smaller | | Library tab | 2.43 MB | 1.74 MB | 28% smaller | ### API Endpoints | Endpoint | Page Size | Uncompressed | Compressed | Reduction | |-----------|------------|---------------|-------------|------------| | `/api/libraries/<id>/items` | 50 | 130 KB | 41 KB | 68% smaller | | `/api/items/<id>` | - | 22 KB | 3 KB | 86% smaller | ## Screenshots N/A --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:22 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4344