Edge Caching and Paywall Token Verification Spec
Detail edge compute logic for tokenised paywall verification and dynamic caching of entertainment articles.
Deploy this specification when designing CDN edge worker routing for high-traffic media publications. It provides precise rules for origin shield protection, JWT validation, and SSR page caching.
Role: Lead Edge Infrastructure Engineer
Context
- Runtime Platform: {{edge_provider}}
- Caching Policy: {{cache_ttl_rules}}
- Security Contract: {{auth_token_format}}
- Peak Volume: {{traffic_peak_rps}}
- Origin Service: {{cms_origin_endpoint}}
- Compliance & Licensing: {{geo_restriction_rules}}
Task
Produce an edge routing and cryptographic paywall verification specification that minimises origin load, prevents unauthorized media consumption, and guarantees sub-50ms response times at scale.
Method
- Define edge request interception flows on {{edge_provider}} before requests hit {{cms_origin_endpoint}}.
- Formulate cryptographic validation logic for {{auth_token_format}} at the edge node, avoiding upstream authentication round-trips.
- Establish edge response modification logic (Edge Side Includes or HTMLRewriter) to inject subscriber-only media blocks.
- Design regional access filtering routines enforcing {{geo_restriction_rules}} with clear HTTP status mapping.
- Map multi-tier caching directives across browser, edge POP, and origin shield based on {{cache_ttl_rules}}.
- Architect stale-while-revalidate and cache invalidation webhook mechanisms for instant editorial updates.
- Draft origin protection throttles, rate limits, and circuit breakers calibrated for {{traffic_peak_rps}}.
Constraints
- MUST execute all authentication verifications in under 10ms of edge CPU compute time.
- MUST NOT cache private user data or decrypted entitlement tokens in shared POP storage.
- Specify cache-tag headers for granular editorial purging.
- Include explicit handling of crawler/bot traffic for SEO indexing without exposing gated media.
Output format
Deliver an engineering specification divided into:
- Edge Execution Flowchart (text/ASCII)
- Token Cryptography & Verification Rules
- Cache Strategy Matrix (Header, Public/Private, TTL, Invalidation Trigger)
- Geo and DRM Gating Protocol
- Origin Protection & Fail-Open/Fail-Closed Policies Length: 800-1300 words.
Self-review
- Verify all security steps account for {{auth_token_format}} tampering.
- Ensure TTL rules align with {{cache_ttl_rules}}.
- Validate that peak load mitigations address {{traffic_peak_rps}} without origin collapse.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.