WP Manifestindependent plugin directory
manifest / performance / font-proxy-cache

Font Proxy Cache

Font Proxy Cache Wordpress Plugin

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/solinter/font-proxy-cache/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress plugin (WordPress 6.2+, PHP 7.4+) that serves external font dependencies from the site itself. The browser no longer contacts fonts.googleapis.com, fonts.gstatic.com or use.fontawesome.com. WordPress fetches those files once, keeps them as content-addressed objects in the persistent object cache (Redis) and serves them from /font-proxy/.... Nothing is written to disk.

<link href="//fonts.googleapis.com/css?family=Montserrat:regular&ver=7.1">
        ↓
<link href="https://example.com/font-proxy/<sig>/fonts.googleapis.com/css?family=Montserrat:regular">

Installation

  1. Copy the font-proxy-cache folder to wp-content/plugins/.
  2. Make sure a persistent object cache is enabled (see Requirements).
  3. Activate Font Proxy Cache under Plugins, or run wp plugin activate font-proxy-cache.

No configuration is needed. Status and cache management are under Tools → Font Proxy Cache.

Requirements

  • A connected persistent object cache. In practice that means the Redis Object Cache plugin with its object-cache.php drop-in enabled (Settings → Redis → Enable Object Cache, or wp redis enable). Other persistent object cache drop-ins should also work, but only Redis Object Cache has been tested.
  • Activation is refused without it. If the object cache later becomes unavailable, the plugin turns itself off and shows an admin notice. "Unavailable" covers three cases: the drop-in is removed, Redis is unreachable, or the group is listed in WP_REDIS_IGNORED_GROUPS.
  • If Redis goes down, the whole site is down, unless graceful mode is on. With WP_REDIS_GRACEFUL unset, the Redis Object Cache drop-in stops the whole site with "Error establishing a Redis connection" whenever Redis is unreachable, before any plugin loads. Define WP_REDIS_GRACEFUL as true in wp-config.php (or via WORDPRESS_CONFIG_EXTRA in the official WordPress Docker image) to keep the site running without Redis. This plugin then switches itself off.
  • While off:
    • pages keep their original CDN URLs
    • /font-proxy/ URLs still referenced by cached pages answer with a 302 to the CDN, with X-Font-Proxy-Cache-Error: font_proxy_cache_unavailable
    • nothing is cached anywhere

How it works

  1. Rewriting page output
    • style_loader_src rewrites enqueued stylesheets.
    • An output buffer rewrites hard-coded <link> tags and `