Edge-first architecture - security and caching at the CDN / proxy
Edge-first architecture moves security and caching decisions toward Azure CDN or Cloudflare, reducing origin load while covering WAF, TLS, rate limits and origin protection.
Edge-first architecture - security and caching at the CDN or proxy
Every request reaching the origin application is consuming origin capacity, even when the request is a bot, an attack or a repeated public resource. A web server is becoming a poor place to perform every security and caching decision. If we move suitable work to the edge, the origin can focus on business operations and protected data.
In this article, we are going to see an edge-first architecture using Azure CDN or Cloudflare. We will cover WAF, DDoS protection, TLS termination, bot filtering, rate limiting, caching and the controls needed to lock the origin to edge traffic. We will discuss a practical example in an upcoming article, and refer to the 2016 CDN article and Cloudflare article for the earlier architecture discussion.
TL;DR Summary
- The edge is the first security and performance boundary before the origin.
- WAF, DDoS protection, TLS termination, bot filtering and rate limiting can stop or reduce traffic early.
- Cache only safe responses and vary the cache by the inputs which change the result.
- Azure CDN and Cloudflare provide different edge capabilities and operational models.
- Lock the origin so it accepts traffic only from approved edge IP ranges or a private path.
- Cloudflare Workers was recently announced, but it is still in beta and should not be treated as a general production platform.
Challenges
Untrusted traffic
Attackers, crawlers and badly behaved clients are reaching the same front door as valid users. If the origin is handling every request, a traffic spike is becoming an application outage.
Repeated content
Public images, scripts and safe reference responses are being requested repeatedly. Sending every request to the origin adds latency and cost while the answer is unchanged.
Origin exposure
An edge service is not protecting an origin if a client can discover and call the origin address directly. The origin must validate the path, host and source network, and sensitive APIs should still enforce application authorization.
What is edge-first architecture?
Edge-first architecture places security, routing and caching decisions as close as possible to the client, before traffic reaches the origin application.
In simple terms, the edge is the front liner. It blocks bad traffic, serves a safe cached response and forwards only the requests which need origin processing.
The following diagram depicts the edge vendor boundary and the protected origin.

The purple path is a valid cacheable request served at the edge. A cache miss or dynamic request is passing through the edge controls to the origin, while blocked traffic does not reach the application.
Why edge-first architecture is important?
Edge-first architecture is important because it is reducing work at the origin and adding controls before the application is reached. A WAF can reject known attack patterns, rate limiting can protect a client or endpoint, and a cache can respond without an origin round trip.
The edge is not a replacement for secure application code. Authentication, authorization and validation remain at the origin, and the cache must never share a response across users incorrectly.
Edge capabilities
| Capability | Purpose | Watch out |
|---|---|---|
| WAF | Block common web attacks | Tune rules and handle false positives |
| DDoS protection | Absorb or mitigate volumetric traffic | Confirm service scope and limits |
| TLS termination | Encrypt client-to-edge traffic | Use HTTPS from edge to origin too |
| Bot filtering | Separate crawlers and suspicious clients | Do not block useful search or partner bots accidentally |
| Rate limiting | Protect endpoint or client capacity | Return and document HTTP 429 |
| Caching | Serve safe repeated responses | Vary by query, header and authorization |
Azure CDN has Verizon and Akamai options, while Cloudflare provides CDN, security and edge controls through its network. Choose from geography, rules, support, origin integration, data requirements and team familiarity.
Selection criteria
Cacheability
Cache public static content and responses with a clear freshness rule. Do not cache private fund data by default. If a response varies by FundId, language, authorization or a feature setting, include that input in the cache key or bypass the cache.
Security boundary
Terminate TLS at the edge only when the origin connection is also protected. Configure WAF and rate rules from real traffic, then monitor blocked and allowed requests.
Origin lock
Use firewall rules, access restrictions or network controls so the origin accepts only approved edge IP ranges. Validate the host header and do not treat a client-supplied “came from edge” header as proof by itself.
Origin locking is also requiring an operational process. Edge IP ranges can change, certificates expire and a new origin may need an allow-list entry. Keep the rule in a reviewed deployment definition, monitor rejected origin requests and test failover before changing the network boundary.
Operational model
Azure CDN can fit an Azure-centric platform, while Cloudflare can fit a provider-independent edge strategy. In our case, choose the service which the team can configure, monitor and change without creating another operational blind spot.
Cloudflare Workers was recently announced and still in beta. Use it only for an explicitly accepted preview experiment, not as an assumption that arbitrary application code can run reliably at the edge.
Cache invalidation is part of the design, not only a deployment command. Define how a changed script, image or public response is becoming fresh, and keep a purge process which an operator can use without disabling the complete cache. A cache which cannot be invalidated is creating a correctness risk.
Request flow
- The client sends HTTPS to the edge.
- The edge checks DDoS and WAF rules.
- Bot filtering and rate limiting decide whether the request continues.
- A safe cache hit returns immediately.
- A miss is forwarded over HTTPS to the locked origin.
- The origin authenticates, authorizes and processes the request.
- The edge stores only a response which is explicitly cacheable.
For a dynamic fund request, the edge may still add value by terminating TLS, rejecting malformed traffic and applying a rate rule even when it is not caching the response. This is the contrast between edge security and edge caching: one can be useful without the other.
Must Do / Should / Don’t
Must Do
- Must lock the origin to approved edge traffic.
- Must use HTTPS from client to edge and edge to origin.
- Must define cache keys and bypass rules for private data.
- Must monitor cache hits, blocked requests, origin errors and latency.
Should
- Should start with static assets and clearly public responses.
- Should tune WAF rules with a review process.
- Should use rate limits before expensive origin processing.
Don’t
- Don’t assume the CDN is an authorization layer.
- Don’t cache a response containing user-specific fund data without a safe key.
- Don’t expose an origin IP and rely only on a secret header.
- Don’t build production architecture around a beta edge function.
Wrap up
In this article, we have looked at edge-first architecture, WAF, DDoS protection, TLS, bot filtering, rate limiting, caching, origin locking and Azure CDN versus Cloudflare.
Thanks for reading this article. In the next article, I will walk you through Kubernetes on Azure with ACS, AKS preview and ACI.
Related Posts
How to configure Azure API Management policies - rate limiting and caching
Azure API Management policies control rate limits, quotas and caching across scopes, with examples covering policy order, request flow, cache safety and testing with curl.
What is resiliency and why do we need a DR strategy? - Part 1
What resiliency is, why we need a DR strategy, how high availability, disaster recovery and backup differ and the principles we follow.
Cloud cost optimization - right-sizing, reserved capacity and auto-shutdown
Azure cloud cost optimisation combines right-sizing, reserved capacity, auto-shutdown, autoscale, tagging, cleanup, Advisor metrics and showback into a repeatable loop.