Skip to main content
mod_pagespeed 2.1 is here — open source (Apache-2.0): the module you know, plus the optimizer worker

mod_pagespeed vs Cloudflare APO

TL;DR

Cloudflare APO caches your WordPress HTML at Cloudflare's edge and serves it from there. mod_pagespeed runs on your origin server and optimizes the response itself — images, CSS, JS, and HTML. APO is faster to enable if you're on WordPress and already on Cloudflare. mod_pagespeed is the option when you want the optimization to live on your infrastructure and work across platforms.

At a glance

  • Deployment

    mod_pagespeed 2.1
    Self-hosted on your origin
    Cloudflare APO
    Managed at Cloudflare's edge
  • Scope

    mod_pagespeed 2.1
    Full HTML pipeline (images, CSS, JS, HTML)
    Cloudflare APO
    Edge HTML caching + asset handling
  • Platform

    mod_pagespeed 2.1
    WordPress, ASP.NET, generic — nginx/Apache/IIS
    Cloudflare APO
    WordPress only (via the Cloudflare for WordPress plugin)
  • Pricing model

    mod_pagespeed 2.1
    Free (Apache-2.0); paid support optional
    Cloudflare APO
    Cloudflare plan + APO add-on (see vendor)
  • Image optimization

    mod_pagespeed 2.1
    WebP and AVIF — responsive variants at origin
    Cloudflare APO
    Cloudflare Polish / Mirage / Image Resizing (separate add-ons)
  • Critical CSS injection

    mod_pagespeed 2.1
    Yes
    Cloudflare APO
    No equivalent feature
  • JS / CSS minification

    mod_pagespeed 2.1
    Yes
    Cloudflare APO
    No — Auto Minify retired Aug 2024; minify at build time
  • HTML rewriting

    mod_pagespeed 2.1
    Yes — at the origin response
    Cloudflare APO
    Cached HTML served from edge
  • Caching

    mod_pagespeed 2.1
    Local Cyclone cache, zero-copy mmap
    Cloudflare APO
    Cloudflare global edge cache
  • CWV optimization

    mod_pagespeed 2.1
    LCP, render-blocking, image bytes; CLS from unsized images
    Cloudflare APO
    TTFB improvement from edge cache
  • Measured page-size reduction

    mod_pagespeed 2.1
    −68% on our own pages (origin pipeline)
    Cloudflare APO
    Faster TTFB, but origin bytes unchanged
  • License

    mod_pagespeed 2.1
    Licensed under the Apache License 2.0; paid tiers are support subscriptions. See the software license.
    Cloudflare APO
    Proprietary SaaS
  • Control over data

    mod_pagespeed 2.1
    Your servers; nothing leaves your origin
    Cloudflare APO
    Traffic and cached content sit at Cloudflare
  • Works without the vendor

    mod_pagespeed 2.1
    Yes — runs on your own servers, no vendor in the request path; your site keeps serving even if we disappear
    Cloudflare APO
    No — APO requires Cloudflare in front

When to choose Cloudflare APO

  • You're already on Cloudflare and your site is WordPress. The setup is essentially "install the plugin, flip the switch."
  • You want a managed solution with no origin tuning. APO is configured in the Cloudflare dashboard, not on your server.
  • Your origin is geographically distant from most visitors and the dominant performance problem is TTFB. Edge HTML caching addresses that directly.
  • You don't want to maintain a build pipeline or an nginx module — you'd rather pay Cloudflare to do it.
  • You don't need critical CSS extraction or origin-side image variant generation.

When to choose mod_pagespeed

  • You're not on WordPress. APO is WordPress-only; mod_pagespeed works on any stack that runs nginx, Apache, or IIS.
  • You don't want to route your traffic through Cloudflare. APO requires it as a hard dependency.
  • You want the optimization to follow the site, not the CDN — if you migrate CDNs, the optimization stays.
  • You care about critical CSS for LCP. That's an origin-side rewrite; an edge cache doesn't extract it.
  • You scale horizontally at the origin. mod_pagespeed 2.1 is free under the Apache License 2.0 on however many servers you run behind it; the server count never enters the bill.
  • You need to keep content on your infrastructure for compliance or data-residency reasons.

How they overlap

Both improve Core Web Vitals and ship fewer bytes. Each also composes with the other tools in its ecosystem — APO with Cloudflare Polish, mod_pagespeed with whatever CDN sits in front of it.

The genuine overlap is HTML minification and basic asset handling. Where they diverge is where the optimization runs (edge vs origin) and what's in scope (HTML cache vs the full origin pipeline).

You can also run them together: mod_pagespeed at the origin, Cloudflare in front for global caching. The optimization happens once at the origin and benefits from edge distribution.

Migrating from Cloudflare APO to mod_pagespeed

Migration is reasonable if you've outgrown WordPress, moved off Cloudflare, or need optimization beyond what APO does — critical CSS, origin-side AVIF encoding, or a single pipeline that follows the site across CDN changes.

If you do migrate:

  1. Keep APO enabled while you stand up mod_pagespeed on the origin. Verify origin-side optimization works in a staging environment.
  2. Disable APO before going live so the two tools don't fight over HTML rewriting. (Cloudflare retired its separate Auto Minify feature in August 2024.)
  3. Leave Cloudflare in front as a plain CDN if you want global distribution — mod_pagespeed's cache hits compose cleanly with it.

Code & config side-by-side

Enabling APO: install the Cloudflare for WordPress plugin, then toggle APO in the Cloudflare dashboard. No server-side configuration.

Installing mod_pagespeed 2.1 for nginx on Debian 11/12/13, Ubuntu 22.04/24.04 (amd64 + arm64), or AlmaLinux 9 (x86_64 + aarch64):

curl -fsSL https://packages.modpagespeed.com/install.sh | sudo sh
sudo apt install nginx-module-pagespeed   # or: sudo dnf install nginx-module-pagespeed

Then enable the equivalent of APO (nginx config):

pagespeed on;
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters convert_jpeg_to_webp,rewrite_css,rewrite_javascript,prioritize_critical_css;
pagespeed FileCachePath /var/cache/pagespeed;

CoreFilters is the audited default set. The specific filters above show that critical-CSS extraction is in scope on the origin side — which it isn't in APO.

Optimization the edge cache can't do

Critical CSS and variant-aware caching run below the CDN, on any stack, and SVG auto-vectorization comes with the Apache module or the reverse-proxy deployment — keep Cloudflare in front if you like. On our own pages the origin pipeline measures −68% page size. Install and run it. Open source under the Apache License 2.0 — free in development and in production.

See also:

Cloudflare and other product names are trademarks of their respective owners. Comparisons reflect publicly available information as of 2026 and are provided for evaluation; We-Amp B.V. is not affiliated with or endorsed by Cloudflare.