GZIP compression and expired headers

Which settings should be set to work GZIP compression and expired headers as ENABLED.

There is remark: Cloudflare will return gzip or brotli encoded responses to compatible clients / browsers for the following content-types:…
But GZIP does not have any checkbox!

I noticed the domain in question is going through Cloudflare which does provide caching.
Using curl to review the headers, we can see it is Cloudflare serving the cache and not the server.

We want to modify our settings on Cloudfare and then test this again.

Even reply from Cloudflare does not help as it is too general:
Measuring TTFB with a pull CDN like ours when dealing with non-cached content hides the following operations which are effectively rolled up in the TTFB time for each HTTP request:

  1. Cloudflare successfully negotiating a connection with your origin.
  2. Cloudflare sending a request on the connection.
  3. The origin generating a response.
  4. Cloudflare receiving the response.

When I put code it will not work inside WP and still 56 points:

# Expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Your document html
ExpiresByType text/html "access plus 0 seconds"
# Data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
# Feed
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
# Favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"
# Media: images, video, audio
ExpiresByType image/gif "access plus 4 months"
ExpiresByType image/png "access plus 4 months"
ExpiresByType image/jpeg "access plus 4 months"
ExpiresByType image/webp "access plus 4 months"
ExpiresByType video/ogg "access plus 4 months"
ExpiresByType audio/ogg "access plus 4 months"
ExpiresByType video/mp4 "access plus 4 months"
ExpiresByType video/webm "access plus 4 months"
# HTC files (css3pie)
ExpiresByType text/x-component "access plus 1 month"
# Webfonts
ExpiresByType font/ttf "access plus 4 months"
ExpiresByType font/otf "access plus 4 months"
ExpiresByType font/woff "access plus 4 months"
ExpiresByType font/woff2 "access plus 4 months"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# CSS and JavaScript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"


I have read an article:

Gzip will be applied by default, no need to toggle it on/off. Brotli will be applied if toggle is set to ON. You can see the change in sizes by visiting your Cloudflare-proxied page with Dev Tools (F12 on Chrome) in Network tab. Under Network Conditions, check/uncheck the browser’s available compression options and fetch the request again.


Wha’s exactly your question concerning the Expires header?

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.