원클릭으로
cdn-edge-computing
Expert reference for CDN strategy, cache configuration, and edge computing patterns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Expert reference for CDN strategy, cache configuration, and edge computing patterns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Expert reference for application security — OWASP Top 10 mitigations, auth/authz, secrets management, cryptography, input validation, dependency hygiene, and secure-by-default code patterns
Expert reference for token counting, prompt compression, cost estimation, and quality preservation when optimizing prompts for Claude models
Experimentation design and A/B testing standards for product teams
Expert reference for digital accessibility — WCAG conformance, ARIA, and inclusive design patterns
Authoritative reference for agent architecture selection, multi-agent orchestration, tool design, memory systems, and failure mode prevention
Expert reference for evaluating LLM systems, RAG pipelines, and AI features in production
| name | cdn-edge-computing |
| description | Expert reference for CDN strategy, cache configuration, and edge computing patterns |
| version | 1 |
max-age=3600 for all responses is not a cache strategy. Static assets, HTML, API responses, and user-specific data each have different caching requirements that must be defined explicitly.max-age=31536000 includeSubDomains preload is required for production domains.If selecting a CDN provider → Cloudflare for general use, DDoS mitigation, WAF, and edge compute (Workers); AWS CloudFront for AWS-native workloads with tight S3/API Gateway integration; Fastly for real-time config propagation (<1s vs Cloudflare's ~30s) and high-traffic media; Akamai for enterprise contracts, SLA guarantees, and media streaming at extreme scale.
If caching static assets (JS, CSS, images with hashed filenames) → Cache-Control: public, max-age=31536000, immutable. The hash in the filename is the version — the TTL should be maximum.
If caching HTML pages → Cache-Control: no-cache (must revalidate with origin) or max-age=60, stale-while-revalidate=300 for tolerable staleness. Never no-store for public pages — it defeats CDN entirely.
If caching API responses → Cache-Control: private for authenticated responses (CDN must not cache). For public API responses: Cache-Control: public, max-age=60, stale-while-revalidate=300, stale-if-error=86400.
If content must be invalidated immediately on update → implement tag-based purging: assign Cache-Tag or Surrogate-Key headers at origin, purge by tag on deployment. Single-URL purge is insufficient for pages that aggregate multiple content pieces.
If traffic to origin exceeds 5,000 req/s → enable origin shield (Cloudflare Tiered Cache, CloudFront Origin Shield). One CDN PoP acts as shared cache for all others — reduces origin load by 60-80%.
If using Cloudflare Workers → appropriate for: auth at edge (<2ms overhead), A/B testing without origin round-trip, geo-based routing, request/response transformation, bot detection. Not appropriate for: database queries, operations >10ms, stateful workflows.
If images are served without CDN optimization → configure automatic WebP/AVIF conversion at edge. WebP is ~30% smaller than JPEG; AVIF is ~50% smaller. Both are supported by >95% of browsers.
Never set Vary: User-Agent — it creates exponentially many cache variants and destroys hit ratio. Use separate URLs or edge logic for device-specific content.
Never use query strings as cache busters for static assets — use content-hashed filenames instead. Query strings complicate cache key design.
Cache-Control Decision Tree by Content Type
Content type?
├── Static asset (hashed filename)
│ └── Cache-Control: public, max-age=31536000, immutable
├── HTML / page
│ ├── Changes frequently → Cache-Control: no-cache (validate every request)
│ └── Changes infrequently → Cache-Control: max-age=300, stale-while-revalidate=3600
├── API response
│ ├── Authenticated → Cache-Control: private, no-store
│ └── Public → Cache-Control: public, max-age=60, stale-while-revalidate=300
└── User-specific data → Cache-Control: private, no-store (always)
The CDN Request Lifecycle
User → CDN Edge PoP → [Cache HIT?]
├── YES → Return cached response (0 origin cost)
└── NO → CDN Edge → [Origin Shield?]
├── HIT → Return (no origin request)
└── MISS → Origin Server
↓
Response + Cache headers
↓
Cache at shield + edge
Edge Compute Use Case Map
<2ms, stateless, high-volume → Cloudflare Workers / Lambda@Edge
✓ Auth token validation
✓ A/B test assignment
✓ Geo-routing
✓ Request header injection
✓ Bot score checking
>10ms, stateful, DB-dependent → Origin (not edge)
✗ Database writes
✗ Payment processing
✗ Session management with external store
| Term | Precise Meaning |
|---|---|
| PoP | Point of Presence — a CDN edge location geographically close to users |
| Cache hit ratio | % of requests served from CDN cache without hitting origin |
| Origin shield | A mid-tier cache layer that consolidates CDN-to-origin requests |
| Cache key | The unique identifier for a cached object; usually URL + selected headers |
| TTL | Time to Live — how long a cached response is considered fresh |
| Stale-while-revalidate | Serve stale content immediately while fetching a fresh copy in background |
| Surrogate key / Cache tag | A label attached to cached objects enabling bulk invalidation by tag |
| Purge | Explicitly remove one or more cached objects before TTL expiry |
| Anycast | Routing method where multiple servers share an IP; user reaches the nearest one |
| Edge function | Code running in CDN PoPs close to users (Cloudflare Workers, Lambda@Edge) |
| WAF | Web Application Firewall — filters malicious requests at the CDN layer |
| HSTS | HTTP Strict Transport Security — forces HTTPS for a specified duration |
Mistake 1: One cache policy for everything
Cache-Control: max-age=3600 on all responses including API and HTMLMistake 2: Caching authenticated responses
Cache-Control: public, max-age=300 — CDN serves user A's data to user BCache-Control: private, no-store. Verify with CDN access logs.Mistake 3: No origin protection
CF-Access-Client-Secret).Mistake 4: TTL-only invalidation
app.a3f9b12.js) makes old URL permanently stale and new URL immediately cached. For HTML: purge by path on deploy.Mistake 5: Not monitoring cache hit ratio
BAD Cache-Control headers:
# Same header for everything — HTML, API, assets
Cache-Control: max-age=3600
# Authenticated user data — will be cached by CDN and shared across users
GET /api/user/profile
Cache-Control: public, max-age=300
GOOD Cache-Control headers:
# Hashed static assets — permanent cache
GET /static/app.a3f9b12.js
Cache-Control: public, max-age=31536000, immutable
# HTML pages — validate but serve stale while revalidating
GET /dashboard
Cache-Control: public, max-age=0, must-revalidate
# or with staleness tolerance:
Cache-Control: public, max-age=60, stale-while-revalidate=300, stale-if-error=86400
# Authenticated API — never CDN-cached
GET /api/user/profile
Authorization: Bearer ...
Cache-Control: private, no-store
# Public API endpoint
GET /api/products
Cache-Control: public, max-age=120, stale-while-revalidate=600
Surrogate-Key: products # enables tag-based purge on product update
max-age=31536000, immutableCache-Control: private, no-storemax-age=31536000 includeSubDomainsVary: User-Agent not present on any cacheable response