★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/solinter/font-proxy-cache/archive/refs/heads/main.zipA 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
- Copy the
font-proxy-cachefolder towp-content/plugins/. - Make sure a persistent object cache is enabled (see Requirements).
- 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.phpdrop-in enabled (Settings → Redis → Enable Object Cache, orwp 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_GRACEFULunset, the Redis Object Cache drop-in stops the whole site with "Error establishing a Redis connection" whenever Redis is unreachable, before any plugin loads. DefineWP_REDIS_GRACEFULastrueinwp-config.php(or viaWORDPRESS_CONFIG_EXTRAin 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 a302to the CDN, withX-Font-Proxy-Cache-Error: font_proxy_cache_unavailable- nothing is cached anywhere
How it works
- Rewriting page output
style_loader_srcrewrites enqueued stylesheets.- An output buffer rewrites hard-coded
<link>tags and `