Varnish Cache¶
Overview¶
StarkOne integrates with Varnish Cache to provide HTTP acceleration for websites. Varnish sits in front of nginx/apache and serves cached responses, dramatically reducing backend load for content-heavy sites.
Requires the Varnish service to be installed. Admin-level controls require administrative_operations.
Global Varnish Dashboard¶
# Status
GET /api/varnish/status
# Global config
GET /api/varnish/config
POST /api/varnish/config
{
"memory": "256M",
"storage": "malloc"
}
# Restart Varnish
POST /api/varnish/restart
# Purge all cached content
POST /api/varnish/purge-all
Per-Website Varnish¶
# Get Varnish settings for a website
GET /api/webapps/:id/varnish
# Enable Varnish for a website
POST /api/webapps/:id/varnish
{
"enabled": true,
"ttl": 3600,
"exclude_urls": ["/wp-admin/", "/cart/"]
}
# Purge website cache
POST /api/webapps/:id/varnish/purge
# By username
GET /api/varnish/website?username=example
POST /api/varnish/website?username=example
POST /api/varnish/website/purge?username=example
Rate Limiting¶
Per-website rate limiting (not Varnish-specific, uses nginx):