Skill

Optimize CDN Configurations for Performance and Security

A CDN skill covering CloudFront, Cloudflare, and origin config for caching strategy, WAF security headers, compression, and multi-CDN failover.

Works with awscloudflarenginx

91
Spark score
out of 100
Updated 7 months ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Automate the configuration, optimization, and security hardening of Content Delivery Networks (CDNs) across major providers like Cloudflare, AWS CloudFront, and Azure CDN.

Outcomes

What it gets done

01

Design and implement effective caching strategies for static and dynamic content.

02

Configure origin shield and edge computing for reduced latency and origin load.

03

Implement security best practices including WAF rules, rate limiting, and security headers.

04

Optimize asset delivery through compression and image optimization techniques.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-cdn-configuration | bash

Overview

CDN Configuration Expert Agent

A CDN skill covering CloudFront, Cloudflare, and origin-server configuration for tiered caching by content type, WAF security headers, rate limiting, and compression. It includes real user monitoring for CDN performance and Route53-based multi-CDN DNS failover. Use it when configuring or hardening a CDN across CloudFront, Cloudflare, or another provider - tiered caching, security headers, or multi-CDN failover - not for general application or database performance work outside the edge layer.

What it does

This skill covers CDN configuration, optimization, and management across major providers - CloudFlare, AWS CloudFront, Azure CDN, Google Cloud CDN, and Fastly - spanning caching strategy, edge computing, performance optimization, and security settings. Its caching strategy design tiers content by type: long TTL (31536000s / 1 year) for versioned static assets, short TTL (300-3600s) with proper cache headers for dynamic content, micro-caching (30-300s) for frequently requested API responses, and Edge-Side Includes for fragment caching personalized content. It covers Origin Shield configuration (reducing origin load via a shield point of presence nearest the origin server, with regional shields based on traffic patterns), CloudFront distribution setup via CloudFormation with managed cache/origin-request/response-header policies, Cloudflare Workers scripts for path-based caching logic, WAF and security headers (HSTS, X-Content-Type-Options, X-Frame-Options, X-XSS-Protection, CSP) via CloudFront Functions, Cloudflare rate limiting for DDoS protection, image optimization and compression settings (gzip and brotli), real user monitoring (RUM) for CDN performance metrics like TTFB and DNS/connect timing, and multi-CDN failover using Route53 DNS-based primary/secondary failover with health checks.

When to use - and when NOT to

Use this skill when configuring or optimizing a CDN across CloudFront, Cloudflare, or another supported provider - it names concrete cache-hit-rate targets (over 90% for static content), TTL values, and specific policy IDs (Managed-CachingOptimized, Managed-CORS-S3Origin) rather than generic advice. It's well suited to setting up tiered caching by content type, hardening the edge with WAF/security headers, and building multi-CDN resilience with DNS failover. It is not a general web performance guide - it's scoped specifically to the CDN/edge layer (origin shields, cache policies, edge functions, DNS failover), not to application-level or database performance work. Its own closing guidance is to always test configurations in staging and roll out gradually with comprehensive monitoring, not to push CDN config changes straight to production.

Inputs and outputs

### Nginx origin configuration
location ~* \.(jpg|jpeg|png|gif|webp)$ {
    expires 1y;
    add_header Cache-Control "public, immutable";
    add_header Vary "Accept";
    
    # Enable compression
    gzip on;
    gzip_types image/svg+xml;
}

Given a CDN provider and traffic pattern, the skill produces provider-specific configuration: CloudFront distribution templates with cache behaviors split by path pattern (long-TTL /static/* versus short-TTL /api/*), Cloudflare Workers scripts implementing path-based cache-control logic, security-header injection functions, rate-limiting configuration objects, origin-side compression and image-caching rules like the one above, a RUM script tracking DNS/connect/TTFB/download timing per navigation, and Route53 failover record sets for multi-CDN resilience.

Who it's for

Infrastructure and platform engineers configuring or hardening a CDN layer who need concrete, provider-specific templates - CloudFormation, Cloudflare Workers, CloudFront Functions, Nginx origin config - rather than abstract caching theory. It suits teams tracking cache-hit ratio, origin load reduction, TTFB, and error rates as core metrics, and that need cost-optimization guidance (price class selection, origin shield, compression, TTL tuning, reserved capacity for predictable traffic) alongside the technical configuration.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.