diff --git a/api/category.go b/api/category.go
index 30b12f473c38474a6fb33ef37c2f390d97daaafd..b7b5c028215395ca604a9931e5aafc079a85e488 100644
--- a/api/category.go
+++ b/api/category.go
@@ -83,7 +83,7 @@ func (c *Controller) GetCategories(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, categories)
+	json.OK(w, r, categories)
 }
 
 // RemoveCategory is the API handler to remove a category.
diff --git a/api/entry.go b/api/entry.go
index a6785fbb88de85dba34f6f8d45c98c077eab7137..b2a4d9dc5a441a480d5a02a620aa995f092d365f 100644
--- a/api/entry.go
+++ b/api/entry.go
@@ -48,7 +48,7 @@ func (c *Controller) GetFeedEntry(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, entry)
+	json.OK(w, r, entry)
 }
 
 // GetEntry is the API handler to get a single entry.
@@ -73,7 +73,7 @@ func (c *Controller) GetEntry(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, entry)
+	json.OK(w, r, entry)
 }
 
 // GetFeedEntries is the API handler to get all feed entries.
@@ -132,7 +132,7 @@ func (c *Controller) GetFeedEntries(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, &entriesResponse{Total: count, Entries: entries})
+	json.OK(w, r, &entriesResponse{Total: count, Entries: entries})
 }
 
 // GetEntries is the API handler to fetch entries.
@@ -184,7 +184,7 @@ func (c *Controller) GetEntries(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, &entriesResponse{Total: count, Entries: entries})
+	json.OK(w, r, &entriesResponse{Total: count, Entries: entries})
 }
 
 // SetEntryStatus is the API handler to change the status of entries.
diff --git a/api/feed.go b/api/feed.go
index b7c46ea1a0ec077c05f4855c1be5169c4602d229..b6b635780df86340bac2929d44fbe3a182265d1c 100644
--- a/api/feed.go
+++ b/api/feed.go
@@ -146,7 +146,7 @@ func (c *Controller) GetFeeds(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, feeds)
+	json.OK(w, r, feeds)
 }
 
 // GetFeed is the API handler to get a feed.
@@ -168,7 +168,7 @@ func (c *Controller) GetFeed(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, feed)
+	json.OK(w, r, feed)
 }
 
 // RemoveFeed is the API handler to remove a feed.
diff --git a/api/icon.go b/api/icon.go
index 0f5aa1bd24f344ffebffc6fb3970bfa8d2bfd9be..052cdbc335effc4142def5f812daf37c31cba4bb 100644
--- a/api/icon.go
+++ b/api/icon.go
@@ -37,7 +37,7 @@ func (c *Controller) FeedIcon(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, &feedIcon{
+	json.OK(w, r, &feedIcon{
 		ID:       icon.ID,
 		MimeType: icon.MimeType,
 		Data:     icon.DataURL(),
diff --git a/api/subscription.go b/api/subscription.go
index 19adc9efdc0c3796008f8e2eaf17b8ec0eeb6679..a28c3b25f48fefb3acea7324f557fe0c6c3ad2d7 100644
--- a/api/subscription.go
+++ b/api/subscription.go
@@ -36,5 +36,5 @@ func (c *Controller) GetSubscriptions(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, subscriptions)
+	json.OK(w, r, subscriptions)
 }
diff --git a/api/user.go b/api/user.go
index 4e5fa82803d8a75b1c29fb81f57519b7cc040e20..b880ba303486cda14aac57f322fc3ac66209debb 100644
--- a/api/user.go
+++ b/api/user.go
@@ -22,7 +22,7 @@ func (c *Controller) CurrentUser(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, user)
+	json.OK(w, r, user)
 }
 
 // CreateUser is the API handler to create a new user.
@@ -119,7 +119,7 @@ func (c *Controller) Users(w http.ResponseWriter, r *http.Request) {
 	}
 
 	users.UseTimezone(ctx.UserTimezone())
-	json.OK(w, users)
+	json.OK(w, r, users)
 }
 
 // UserByID is the API handler to fetch the given user by the ID.
@@ -148,7 +148,7 @@ func (c *Controller) UserByID(w http.ResponseWriter, r *http.Request) {
 	}
 
 	user.UseTimezone(ctx.UserTimezone())
-	json.OK(w, user)
+	json.OK(w, r, user)
 }
 
 // UserByUsername is the API handler to fetch the given user by the username.
@@ -171,7 +171,7 @@ func (c *Controller) UserByUsername(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, user)
+	json.OK(w, r, user)
 }
 
 // RemoveUser is the API handler to remove an existing user.
diff --git a/fever/fever.go b/fever/fever.go
index 9fb6bdbceb19f7ce4db7915d18f842563ac569f1..44e155a94ca3aac1ec35f040db3ba56bf9492aca 100644
--- a/fever/fever.go
+++ b/fever/fever.go
@@ -155,7 +155,7 @@ func (c *Controller) Handler(w http.ResponseWriter, r *http.Request) {
 	case r.FormValue("mark") == "group":
 		c.handleWriteGroups(w, r)
 	default:
-		json.OK(w, newBaseResponse())
+		json.OK(w, r, newBaseResponse())
 	}
 }
 
@@ -203,7 +203,7 @@ func (c *Controller) handleGroups(w http.ResponseWriter, r *http.Request) {
 
 	result.FeedsGroups = c.buildFeedGroups(feeds)
 	result.SetCommonValues()
-	json.OK(w, result)
+	json.OK(w, r, result)
 }
 
 /*
@@ -262,7 +262,7 @@ func (c *Controller) handleFeeds(w http.ResponseWriter, r *http.Request) {
 
 	result.FeedsGroups = c.buildFeedGroups(feeds)
 	result.SetCommonValues()
-	json.OK(w, result)
+	json.OK(w, r, result)
 }
 
 /*
@@ -304,7 +304,7 @@ func (c *Controller) handleFavicons(w http.ResponseWriter, r *http.Request) {
 	}
 
 	result.SetCommonValues()
-	json.OK(w, result)
+	json.OK(w, r, result)
 }
 
 /*
@@ -414,7 +414,7 @@ func (c *Controller) handleItems(w http.ResponseWriter, r *http.Request) {
 	}
 
 	result.SetCommonValues()
-	json.OK(w, result)
+	json.OK(w, r, result)
 }
 
 /*
@@ -445,7 +445,7 @@ func (c *Controller) handleUnreadItems(w http.ResponseWriter, r *http.Request) {
 	var result unreadResponse
 	result.ItemIDs = strings.Join(itemIDs, ",")
 	result.SetCommonValues()
-	json.OK(w, result)
+	json.OK(w, r, result)
 }
 
 /*
@@ -477,7 +477,7 @@ func (c *Controller) handleSavedItems(w http.ResponseWriter, r *http.Request) {
 
 	result := &savedResponse{ItemIDs: strings.Join(itemsIDs, ",")}
 	result.SetCommonValues()
-	json.OK(w, result)
+	json.OK(w, r, result)
 }
 
 /*
@@ -534,7 +534,7 @@ func (c *Controller) handleWriteItems(w http.ResponseWriter, r *http.Request) {
 		}()
 	}
 
-	json.OK(w, newBaseResponse())
+	json.OK(w, r, newBaseResponse())
 }
 
 /*
@@ -575,7 +575,7 @@ func (c *Controller) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, newBaseResponse())
+	json.OK(w, r, newBaseResponse())
 }
 
 /*
@@ -616,7 +616,7 @@ func (c *Controller) handleWriteGroups(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, newBaseResponse())
+	json.OK(w, r, newBaseResponse())
 }
 
 /*
diff --git a/http/response/json/json.go b/http/response/json/json.go
index ff0f06be3666f0067a909fcf4d8ed34ff75eda8a..6f3eb15cc00c1a23a81e2d62ddef22e0e3baa9eb 100644
--- a/http/response/json/json.go
+++ b/http/response/json/json.go
@@ -9,14 +9,14 @@ import (
 	"errors"
 	"net/http"
 
+	"github.com/miniflux/miniflux/http/response"
 	"github.com/miniflux/miniflux/logger"
 )
 
 // OK sends a JSON response with the status code 200.
-func OK(w http.ResponseWriter, v interface{}) {
+func OK(w http.ResponseWriter, r *http.Request, v interface{}) {
 	commonHeaders(w)
-	w.WriteHeader(http.StatusOK)
-	w.Write(toJSON(v))
+	response.Compress(w, r, toJSON(v))
 }
 
 // Created sends a JSON response with the status code 201.
diff --git a/http/response/response.go b/http/response/response.go
index c5ae3fa15ec499f48da949b002c93ec188cd6d3e..f79262542637b818333e3114157817b25f018f04 100644
--- a/http/response/response.go
+++ b/http/response/response.go
@@ -23,7 +23,7 @@ func NotModified(w http.ResponseWriter) {
 }
 
 // Cache returns a response with caching headers.
-func Cache(w http.ResponseWriter, r *http.Request, mimeType, etag string, content []byte, duration time.Duration) {
+func Cache(w http.ResponseWriter, r *http.Request, mimeType, etag string, data []byte, duration time.Duration) {
 	w.Header().Set("Content-Type", mimeType)
 	w.Header().Set("ETag", etag)
 	w.Header().Set("Cache-Control", "public")
@@ -31,8 +31,14 @@ func Cache(w http.ResponseWriter, r *http.Request, mimeType, etag string, conten
 
 	if etag == r.Header.Get("If-None-Match") {
 		w.WriteHeader(http.StatusNotModified)
-	} else {
-		w.Write(content)
+		return
+	}
+
+	switch mimeType {
+	case "text/javascript; charset=utf-8", "text/css; charset=utf-8":
+		Compress(w, r, data)
+	default:
+		w.Write(data)
 	}
 }
 
diff --git a/middleware/fever.go b/middleware/fever.go
index 78217e4ae224e536dda846493ff2913b29a3afb6..6211fb79c9f52621816cbb7b3875bdb5c47b198c 100644
--- a/middleware/fever.go
+++ b/middleware/fever.go
@@ -20,13 +20,13 @@ func (m *Middleware) FeverAuth(next http.Handler) http.Handler {
 		user, err := m.store.UserByFeverToken(apiKey)
 		if err != nil {
 			logger.Error("[Middleware:Fever] %v", err)
-			json.OK(w, map[string]int{"api_version": 3, "auth": 0})
+			json.OK(w, r, map[string]int{"api_version": 3, "auth": 0})
 			return
 		}
 
 		if user == nil {
 			logger.Info("[Middleware:Fever] Fever authentication failure")
-			json.OK(w, map[string]int{"api_version": 3, "auth": 0})
+			json.OK(w, r, map[string]int{"api_version": 3, "auth": 0})
 			return
 		}
 
diff --git a/ui/entry_scraper.go b/ui/entry_scraper.go
index 75e4040f2b522a3c7fe2b30a47b67349c35190c8..aea9b209e5e26ba016403bc3e311ec6f847398d0 100644
--- a/ui/entry_scraper.go
+++ b/ui/entry_scraper.go
@@ -49,5 +49,5 @@ func (c *Controller) FetchContent(w http.ResponseWriter, r *http.Request) {
 	entry.Content = sanitizer.Sanitize(entry.URL, content)
 	c.store.UpdateEntryContent(entry)
 
-	json.Created(w, map[string]string{"content": entry.Content})
+	json.OK(w, r, map[string]string{"content": entry.Content})
 }
diff --git a/ui/entry_toggle_bookmark.go b/ui/entry_toggle_bookmark.go
index 423fde87c89e1793578211d53db9e7cd1e8b03eb..9d94cd18a6b2efaa24a9feadf26f94565c596819 100644
--- a/ui/entry_toggle_bookmark.go
+++ b/ui/entry_toggle_bookmark.go
@@ -28,5 +28,5 @@ func (c *Controller) ToggleBookmark(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	json.OK(w, "OK")
+	json.OK(w, r, "OK")
 }
diff --git a/ui/entry_update_status.go b/ui/entry_update_status.go
index 3174d85f49fc89d4dcef357b3a5b542463017a16..bafa0a092adab997e0a70da87a600b2840ca79af 100644
--- a/ui/entry_update_status.go
+++ b/ui/entry_update_status.go
@@ -35,5 +35,5 @@ func (c *Controller) UpdateEntriesStatus(w http.ResponseWriter, r *http.Request)
 		return
 	}
 
-	json.OK(w, "OK")
+	json.OK(w, r, "OK")
 }
diff --git a/ui/static_manifest.go b/ui/static_manifest.go
index 27abaec63e7e2faa7d416422202dfaad09380a2b..96814fe16007da8962459411c3ef7ebe19669148 100644
--- a/ui/static_manifest.go
+++ b/ui/static_manifest.go
@@ -50,5 +50,5 @@ func (c *Controller) WebManifest(w http.ResponseWriter, r *http.Request) {
 		},
 	}
 
-	json.OK(w, manifest)
+	json.OK(w, r, manifest)
 }