# CMS Platforms

> Ready-to-use Trident configuration templates for WordPress, Drupal, Strapi, Ghost, and Payload CMS.

Ready-to-use Trident configuration templates for popular content management systems. Each template includes cache rules, tag-based invalidation, and bypass rules tailored to the platform.

---

## WordPress

<Admonition type="info" title="Most Comprehensive Template">
This template supports WooCommerce (cart, checkout, account, wishlist, compare), multi-language setups with vary headers, ESI-ready configuration, and extensive request/response rules. Origin TTL mode respects backend `Cache-Control` headers so your WordPress caching plugin stays in control.
</Admonition>

```json
{
  "server": {
    "listeners": [{ "address": "0.0.0.0:8090", "protocol": "http1" }],
    "preserve_host": true
  },
  "admin": {
    "enabled": true,
    "address": "0.0.0.0:9301",
    "auth_token": "${TRIDENT_ADMIN_TOKEN}"
  },
  "metrics": {
    "enabled": true,
    "address": "0.0.0.0:9190",
    "path": "/metrics",
    "stats_path": "/stats"
  },
  "cache": {
    "max_memory": "2GB",
    "max_entries": 1000000,
    "grace_period": "30m",
    "key": {
      "hash_algorithm": "sha256",
      "include_query": true,
      "normalize_query": true,
      "cache_with_cookies": true,
      "ignore_client_cache_control": true,
      "honor_vary": true,
      "vary_headers": ["X-WC-Currency", "X-WC-Country"]
    },
    "tags": {
      "headers": ["X-Cache-Tags"],
      "separator": ",",
      "strip_header": false
    },
    "poisoning": {
      "header_allowlist": [
        "Accept",
        "Accept-Encoding",
        "Accept-Language",
        "Origin",
        "X-UA-Device",
        "X-WC-Currency",
        "X-WC-Country"
      ]
    }
  },
  "ttl": {
    "mode": "origin",
    "default": "5m",
    "max": "7d"
  },
  "backends": [
    {
      "name": "default",
      "host": "nginx-backend",
      "port": 80,
      "health": { "path": "/backend-health", "interval": "10s", "timeout": "2s" }
    }
  ],
  "directors": [
    {
      "name": "default",
      "backends": ["default"],
      "strategy": "round_robin"
    }
  ],
  "rules": {
    "request": [
      {
        "name": "wp_admin",
        "match": { "path": { "pattern": "^/wp-admin" } },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "wp_login",
        "match": { "path": "/wp-login.php" },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "wp_cron",
        "match": { "path": "/wp-cron.php" },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "wp_comments",
        "match": { "path": "/wp-comments-post.php" },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "wp_ajax",
        "match": { "path": "/wp-admin/admin-ajax.php" },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "wp_rest_write",
        "match": { "path": { "pattern": "^/wp-json/" }, "method": ["POST", "PUT", "DELETE", "PATCH"] },
        "action": "pass",
        "priority": 90
      },
      {
        "name": "wp_logged_in",
        "match": { "header": { "Cookie": { "pattern": "wordpress_logged_in_" } } },
        "action": "pass",
        "priority": 80
      },
      {
        "name": "post_requests",
        "match": { "method": "POST" },
        "action": "pass",
        "priority": 70
      },
      {
        "name": "woo_cart",
        "match": { "path": { "pattern": "^/(cart|winkelwagen|panier|warenkorb|carrito)(/|$)" } },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "woo_checkout",
        "match": { "path": { "pattern": "^/(checkout|afrekenen|paiement|kasse|caja)(/|$)" } },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "woo_account",
        "match": { "path": { "pattern": "^/(my-account|mijn-account|mon-compte|mein-konto|mi-cuenta)(/|$)" } },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "woo_wishlist",
        "match": { "path": { "pattern": "^/(wishlist|verlanglijst|liste-de-souhaits|wunschliste|lista-de-deseos)(/|$)" } },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "woo_compare",
        "match": { "path": { "pattern": "^/(compare|vergelijken|comparer|vergleichen|comparar)(/|$)" } },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "woo_ajax",
        "match": { "path": "/?wc-ajax=" },
        "action": "pass",
        "priority": 100
      },
      {
        "name": "woo_api",
        "match": { "path": { "pattern": "^/wc-api/" } },
        "action": "pass",
        "priority": 100
      }
    ],
    "response": [
      {
        "name": "wp_static_long",
        "match": { "path": { "pattern": "^/wp-(content|includes)/.*\\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$" } },
        "action": { "ttl": "30d" },
        "priority": 100
      },
      {
        "name": "wp_uploads",
        "match": { "path": { "pattern": "^/wp-content/uploads/" } },
        "action": { "ttl": "30d" },
        "priority": 100
      },
      {
        "name": "wp_feeds",
        "match": { "path": { "pattern": "^/feed" } },
        "action": { "ttl": "15m" },
        "priority": 90
      },
      {
        "name": "wp_rest_read",
        "match": { "path": { "pattern": "^/wp-json/" }, "status": 200 },
        "action": { "ttl": "5m" },
        "priority": 80
      },
      {
        "name": "wp_sitemap",
        "match": { "path": { "pattern": "sitemap.*\\.xml$" } },
        "action": { "ttl": "1h" },
        "priority": 80
      },
      {
        "name": "wp_archives",
        "match": { "path": { "pattern": "^/(category|tag|author|[0-9]{4}/)" } },
        "action": { "ttl": "10m" },
        "priority": 70
      },
      {
        "name": "wp_homepage",
        "match": { "path": "/" },
        "action": { "ttl": "5m" },
        "priority": 60
      },
      {
        "name": "woo_shop",
        "match": { "path": { "pattern": "^/shop(/|$)" } },
        "action": { "ttl": "5m" },
        "priority": 70
      },
      {
        "name": "woo_category",
        "match": { "path": { "pattern": "^/product-category/" } },
        "action": { "ttl": "10m" },
        "priority": 70
      },
      {
        "name": "woo_tag",
        "match": { "path": { "pattern": "^/product-tag/" } },
        "action": { "ttl": "10m" },
        "priority": 70
      },
      {
        "name": "no_cache_errors",
        "match": { "status": [400, 401, 403, 404, 500, 502, 503, 504] },
        "action": "pass",
        "priority": 200
      },
      {
        "name": "no_cache_redirects",
        "match": { "status": [301, 302, 303, 307, 308] },
        "action": "pass",
        "priority": 200
      }
    ]
  }
}
```

---

## Drupal

<Admonition type="info" title="Native Cache Tag Integration">
Drupal natively emits `X-Drupal-Cache-Tags` headers with space-separated tags, enabling precise tag-based invalidation without any additional modules. This template handles admin, user, node editing, batch operations, and JSON:API routes.
</Admonition>

```json
{
  "server": {
    "listen": ["0.0.0.0:8080"],
    "admin_listen": "127.0.0.1:9100",
    "metrics_listen": "0.0.0.0:9191"
  },
  "cache": {
    "max_size": "2GB",
    "default_ttl": "1h",
    "stale_while_revalidate": "60s",
    "stale_if_error": "300s",
    "tags": {
      "enabled": true,
      "header_name": "X-Drupal-Cache-Tags",
      "separator": " "
    }
  },
  "backends": {
    "drupal": {
      "host": "127.0.0.1",
      "port": 9000
    }
  },
  "directors": {
    "default": {
      "backends": ["drupal"],
      "strategy": "round_robin"
    }
  },
  "rules": [
    {
      "name": "drupal_files",
      "match": { "path_prefix": "/sites/default/files/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "drupal_core",
      "match": { "path_prefix": "/core/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "drupal_modules",
      "match": { "path_prefix": "/modules/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "drupal_themes",
      "match": { "path_prefix": "/themes/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "drupal_admin",
      "match": { "path_prefix": "/admin" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "drupal_user",
      "match": { "path_prefix": "/user" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "drupal_node_edit",
      "match": { "path_regex": "/node/\\d+/edit" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "drupal_batch",
      "match": { "path": "/batch" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "drupal_jsonapi",
      "match": { "path_prefix": "/jsonapi/" },
      "action": { "cache": true, "ttl": "5m", "methods": ["GET"] }
    },
    {
      "name": "drupal_session",
      "match": { "cookie_regex": "SESS[a-z0-9]+" },
      "action": { "cache": false, "pass": true }
    }
  ]
}
```

---

## Strapi

<Admonition type="info" title="Headless CMS API Caching">
Strapi is a headless CMS that exposes content through REST and GraphQL APIs. This template caches API and GraphQL GET requests while bypassing authentication and user management endpoints. Uploaded media assets receive long TTLs.
</Admonition>

```json
{
  "server": {
    "listen": ["0.0.0.0:8080"],
    "admin_listen": "127.0.0.1:9100",
    "metrics_listen": "0.0.0.0:9191"
  },
  "cache": {
    "max_size": "1GB",
    "default_ttl": "30m",
    "stale_while_revalidate": "60s",
    "stale_if_error": "300s",
    "tags": {
      "enabled": true,
      "header_name": "X-Cache-Tags",
      "separator": ","
    }
  },
  "backends": {
    "strapi": {
      "host": "127.0.0.1",
      "port": 1337
    }
  },
  "directors": {
    "default": {
      "backends": ["strapi"],
      "strategy": "round_robin"
    }
  },
  "rules": [
    {
      "name": "strapi_admin",
      "match": { "path_prefix": "/admin" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "strapi_uploads",
      "match": { "path_prefix": "/uploads/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "strapi_api",
      "match": { "path_prefix": "/api/" },
      "action": { "cache": true, "ttl": "15m", "methods": ["GET"] }
    },
    {
      "name": "strapi_graphql",
      "match": { "path": "/graphql" },
      "action": { "cache": true, "ttl": "15m", "methods": ["GET"] }
    },
    {
      "name": "strapi_auth",
      "match": { "path_prefix": "/api/auth/" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "strapi_users",
      "match": { "path_prefix": "/api/users/" },
      "action": { "cache": false, "pass": true }
    }
  ]
}
```

---

## Ghost

<Admonition type="info" title="Blog-Optimized Caching">
Ghost is a publishing platform focused on content delivery. This template caches theme assets, uploaded content, RSS feeds, and sitemaps with appropriate TTLs. The admin panel and member-only pages are bypassed entirely.
</Admonition>

```json
{
  "server": {
    "listen": ["0.0.0.0:8080"],
    "admin_listen": "127.0.0.1:9100",
    "metrics_listen": "0.0.0.0:9191"
  },
  "cache": {
    "max_size": "1GB",
    "default_ttl": "1h",
    "stale_while_revalidate": "60s",
    "stale_if_error": "300s",
    "tags": {
      "enabled": true,
      "header_name": "X-Cache-Tags",
      "separator": ","
    }
  },
  "backends": {
    "ghost": {
      "host": "127.0.0.1",
      "port": 2368
    }
  },
  "directors": {
    "default": {
      "backends": ["ghost"],
      "strategy": "round_robin"
    }
  },
  "rules": [
    {
      "name": "ghost_admin",
      "match": { "path_prefix": "/ghost/" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "ghost_assets",
      "match": { "path_prefix": "/assets/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "ghost_content",
      "match": { "path_prefix": "/content/" },
      "action": { "cache": true, "ttl": "7d" }
    },
    {
      "name": "ghost_public",
      "match": { "path_prefix": "/public/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "ghost_api",
      "match": { "path_prefix": "/ghost/api/" },
      "action": { "cache": true, "ttl": "5m", "methods": ["GET"] }
    },
    {
      "name": "ghost_members",
      "match": { "path_prefix": "/members/" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "ghost_rss",
      "match": { "path": "/rss/" },
      "action": { "cache": true, "ttl": "15m" }
    },
    {
      "name": "ghost_sitemap",
      "match": { "path_regex": "/sitemap.*\\.xml" },
      "action": { "cache": true, "ttl": "1h" }
    }
  ]
}
```

---

## Payload CMS

<Admonition type="info" title="Node.js Headless CMS">
Payload CMS is a TypeScript-first headless CMS. This template caches REST API and GraphQL GET requests along with media assets. The admin panel and user authentication endpoints are bypassed to ensure sessions work correctly.
</Admonition>

```json
{
  "server": {
    "listen": ["0.0.0.0:8080"],
    "admin_listen": "127.0.0.1:9100",
    "metrics_listen": "0.0.0.0:9191"
  },
  "cache": {
    "max_size": "1GB",
    "default_ttl": "30m",
    "stale_while_revalidate": "60s",
    "stale_if_error": "300s",
    "tags": {
      "enabled": true,
      "header_name": "X-Cache-Tags",
      "separator": ","
    }
  },
  "backends": {
    "payload": {
      "host": "127.0.0.1",
      "port": 3000
    }
  },
  "directors": {
    "default": {
      "backends": ["payload"],
      "strategy": "round_robin"
    }
  },
  "rules": [
    {
      "name": "payload_admin",
      "match": { "path_prefix": "/admin" },
      "action": { "cache": false, "pass": true }
    },
    {
      "name": "payload_api",
      "match": { "path_prefix": "/api/" },
      "action": { "cache": true, "ttl": "15m", "methods": ["GET"] }
    },
    {
      "name": "payload_graphql",
      "match": { "path": "/api/graphql" },
      "action": { "cache": true, "ttl": "15m", "methods": ["GET"] }
    },
    {
      "name": "payload_media",
      "match": { "path_prefix": "/media/" },
      "action": { "cache": true, "ttl": "30d" }
    },
    {
      "name": "payload_auth",
      "match": { "path_prefix": "/api/users/" },
      "action": { "cache": false, "pass": true }
    }
  ]
}
```
