CDN, WAF and DDoS basics
An EU edge in front of a bucket website, app or load balancer: caching, purge, web ACLs, what DDoS filtering covers.
What it is
A distribution puts the Deutsche Cloud edge in front of one origin — a bucket website, an app, a load balancer, or any public web server — and serves it from edge nodes in Falkenstein and Nuremberg (and Helsinki, for organisations that allow EU locations outside Germany). The edge caches what the origin allows it to cache, purges on request, and runs a web ACL: a web application firewall with managed rules against common injections, rate limits, IP and country lists, and a bot challenge.
Everything runs on machines Deutsche Cloud operates in the EU, with Deutsche Cloud IAM and audit. What the edge does with your traffic is visible to you: per-request log lines with the cache outcome and every WAF match, per-minute numbers, and every edge node's own counters.
Find it under CDN in the console, dcloud cdn / dcloud waf on the command line, the cdn.* / waf.* MCP tools, and the SDKs.
Concepts
| Term | Meaning |
|---|---|
| Distribution | One origin behind the edge, its names, cache settings and web ACL. Answers at once at <id>.cdn.apps.<root>. |
| Origin | bucket (a bucket with its static website on), app (a deployed app), lb (a load balancer), or custom (a public host name, https or http). |
| Alias | A name of your own (www.example.com, or example.com itself) in one of your hosted zones. Deutsche Cloud writes a CNAME to the distribution (an ALIAS at a zone apex) and issues its certificate; it is served once the certificate is. |
| Edge node | One machine per zone (de1a, de1b; fi1a for fi1). All serve at once; DNS hands out every healthy one. |
| Invalidation | A purge: paths, path prefixes (/img/*), everything (/*) or tags. |
| Web ACL | An ordered list of rules (managed groups, match, IP, country, rate) with an action each: block, count, allow or challenge. |
| Origin token | A secret sent on every request to the origin as X-EWS-CDN-Token. Check it at the origin to accept traffic only from your distribution. |
How to
Put a bucket website behind the edge
dcloud s3 bucket-access set-website my-site --index-document index.html # objects public by bucket policy
dcloud cdn distributions create --name my-site --origin '{"type":"bucket","bucket":"my-site"}'
# → hostname 1a2b3c4d5e6f.cdn.apps.<root>, status deploying → deployed within a minute
curl -sI https://1a2b3c4d5e6f.cdn.apps.<root>/ | grep -i x-cache # MISS, then HITAn app or a load balancer
dcloud cdn distributions create --name shop --origin '{"type":"app","appId":"<app id>"}'
dcloud cdn distributions create --name api --origin '{"type":"lb","loadBalancerId":"<lb id>"}'A custom origin must resolve to public addresses only; private, link-local, loopback and the platform's own addresses are refused when you set it, and again on the edge every time the name is resolved (every 30 s), so a later DNS change cannot point the edge inward.
Your own name
dcloud cdn distributions update <id> --aliases www.example.comThe name must be in one of your hosted zones (Deutsche Cloud DNS). Deutsche Cloud writes www.example.com CNAME <id>.cdn.apps.<root> unless the name already has records of yours (then the response tells you what to point it at), and issues a certificate by DNS-01. aliasCertificate.status goes pending → active; until then the alias is not served, never with another certificate.
If your domain's DNS stays with another provider, delegate just the name: create a hosted zone for it here (shop.example.com), and at your provider add NS records for shop.example.com pointing to the zone's nameservers. Names whose DNS is entirely elsewhere (a certificate proven over HTTP, or a CNAME you create at your provider) are not supported yet.
HTTP to HTTPS
redirectHttps: true (console: Redirect http:// to https://, on by default in the create form) answers every http:// request with a 308 to the same URL on https://. Your own names redirect once their certificate is active; until then they are not served at all. Off, http:// is served like https://.
A zone apex (example.com itself) cannot hold a CNAME, so there Deutsche Cloud writes an ALIAS to the distribution instead: it answers A and AAAA with the distribution's healthy edge nodes, exactly as its platform name does, with a TTL of at most 30 s, and your MX, TXT and other apex records stay beside it. If the apex already has A, AAAA or another ALIAS of yours, Deutsche Cloud leaves them and the response says so.
Attach a web ACL before you add a name: a new certificate is public in the Certificate Transparency logs within seconds, and scanners follow. On dev, one probed a fresh name for /secrets.json, /server.key, /wp-config.php and 46 other paths about four seconds after its certificate was issued. Those requests reach your origin and count as requests.
You can also write the record yourself (DNS → zone → Add record → ALIAS → Points at → the distribution, or "distributionId" in the records API, or distribution_id on dcloud_dns_record). A record only sends the name to the edge: add the name to the distribution's custom names too, for its certificate. The distribution page lists names whose records point at it but that it does not serve, with a button to add each.
Purge
dcloud cdn invalidations create <id> --paths /index.html --paths '/img/*'
dcloud cdn invalidations create <id> --tags product-42
dcloud cdn invalidations list <id> # status completed once every live edge node applied itEach node applies a purge within a few seconds of its creation; the invalidation is marked completed once every live node has reported it applied (usually under a minute). Tags come from your origin's Cache-Tag (comma-separated) or Surrogate-Key (space-separated) response headers; the edge strips both before the response reaches the viewer.
Protect it with a web ACL
dcloud waf web-acls create --name default # the EWS Core defaults
dcloud cdn distributions update <id> --web-acl-id <acl id>Add rules (the whole list is replaced on update):
[
{ "id": "office", "action": "allow", "statement": { "type": "ipSet", "cidrs": ["198.51.100.0/24"] } },
{ "id": "ews-core-sqli", "action": "block", "statement": { "type": "managed", "group": "sqli" } },
{ "id": "ews-core-xss", "action": "block", "statement": { "type": "managed", "group": "xss" } },
{ "id": "login", "action": "block", "statement": { "type": "rate", "key": "ip", "pathPrefix": "/login", "limit": 20, "windowSeconds": 60 } },
{ "id": "admin", "action": "challenge", "statement": { "type": "match", "field": "path", "op": "prefix", "value": "/admin" } },
{ "id": "geo", "action": "count", "statement": { "type": "geo", "countries": ["XX"] } }
]Then watch what it matches: dcloud waf web-acls logs <acl id>, or Monitoring → Logs (resource type cdn_distribution, stream waf).
The same web ACL can protect an application load balancer: dcloud lb load-balancers update <lb id> --web-acl-id <acl id> (see Load balancers). It runs there in the same proxy, before the load balancer's rules and redirects; its matches go to the load balancer's waf stream and into the same dcloud waf web-acls logs.
Caching
Every setting below can be changed after creation: on the distribution's Overview tab, Caching › Edit (on/off, the three TTLs, query strings with an allowlist, cookies, the two stale windows) and Origin › Change (another bucket website, app, load balancer or server; port and Host header for your own server). Over the API it is PATCH /cdn/api/distributions/{id} with cache or origin (dcloud cdn distributions update). New requests follow within about ten seconds; objects already cached keep their time until they expire or you purge them.
The edge follows your origin's headers, CloudFront's way:
- Only
GETandHEAD. A request withAuthorizationorRangegoes to the origin and is never stored. - How long:
s-maxage, elsemax-age, elseExpires, else the distribution'sdefaultTtl(86,400 s); then clamped tominTtl…maxTtl. The origin'sAgeis subtracted. - Never stored:
Cache-Control: private,no-storeorno-cache; a response withSet-Cookie;Varyon anything butAccept-Encoding; objects above 10 MiB; statuses other than 200, 203, 204, 300, 301, 404, 405, 410, 414, 501. An error without explicit freshness is kept 10 s. - Cookies: by default they are not sent to the origin, and requests with cookies are cached like any other. With
cache.forwardCookies: truethey are sent, and a request carrying a cookie is never answered from the cache. - The key is the path, the query string (
queryString: all,none, orallowlistwithqueryKeys) and the encoding the viewer accepts (br, gzip or none). The edge asks the origin for exactly that encoding, so a stored object only goes to clients that can read it. - Compression is the origin's: what it sends gzip- or Brotli-compressed is passed on and kept per encoding. The edge does not compress what the origin sends uncompressed.
- Many viewers asking for the same missing object at once cause one origin request; the others wait for it.
- Viewers see
X-Cache: HIT | MISS | BYPASS | STALE | STALE-ERROR,Age, andX-EWS-Edge(which node answered). A miss that was not stored says why inX-Cache-Skip. Conditional requests (If-None-Match,If-Modified-Since) are answered 304 from the cache. - Each edge node keeps objects in memory (3 GiB per node) and on its disk (up to 40 GiB, at most half the free space), each shared fairly between the distributions on it. Everything stored in memory is also written to disk; a node that restarts or reboots answers from its disk at once instead of starting cold. A purge removes objects from both, including one issued while a node was down: the node replays it when it comes back, against what it had stored before the purge.
Stale objects (origin outages)
An object that has expired is not thrown away at once (RFC 5861):
- stale-if-error — when the origin cannot be reached, times out, has no healthy address, or answers 500, 502, 503 or 504, the edge answers with the expired copy instead (
X-Cache: STALE-ERROR), for up tocache.staleIfErrorseconds after it expired (default 86,400 = one day). Your site stays up through an origin outage for everything that was cached. - stale-while-revalidate — for up to
cache.staleWhileRevalidateseconds after it expired (default 0 = off) the edge answers with the expired copy at once (X-Cache: STALE) and fetches a fresh one from the origin in the background, once, so no viewer waits for the origin.
The origin decides per object: Cache-Control: stale-while-revalidate=N and stale-if-error=N win over the distribution's settings, and must-revalidate or proxy-revalidate turn both off. Both are capped at 604,800 s (a week). A stale answer counts as a hit; the background fetch is not charged as delivered bytes.
dcloud cdn distributions update <id> --cache '{"staleWhileRevalidate": 60, "staleIfError": 3600}'The web application firewall
Rules run in order. The first allow, block or unpassed challenge decides; count matches are logged and evaluation goes on. Nothing decided: the ACL's defaultAction (allow unless you set block).
| Statement | Matches |
|---|---|
ipSet |
The client address in one of up to 10,000 CIDRs (IPv4 or IPv6). |
geo |
The client's country (ISO 3166 alpha-2); XX = unknown. From DB-IP's IP to Country Lite, updated monthly. |
match |
path, query, uri, method, a header, or the body: exact, prefix, contains or regex (no look-around), optionally negate. |
rate |
More than limit requests per windowSeconds from one client (ip; IPv6 by /64) or one client per path (ipPath), optionally only under a path. 429 with Retry-After. |
managed |
A group of the Deutsche Cloud Core rule set (below), with rule ids to exclude. |
Rate limits count across all edge nodes. Every second each node tells the others what it counted (signed, and as keyed hashes: no client address leaves a node in the clear), so a client spread over Falkenstein and Nuremberg is held to the limit once. It can overshoot by what the other nodes let through in that last second, never more (a limit of 100 per minute, 8 requests a second to each of two nodes: 105 got through, not 200). If a node cannot hear another for 5 seconds it counts on its own again for that node's share (it fails open, it never blocks more), and after a minute your organization gets a CDN Rate Limits Per Node event (ews.cdn), and CDN Rate Limits Shared Again when it is over. On an application load balancer one node serves at a time, so counts there are exact.
The challenge answers a browser (a GET or HEAD that accepts text/html) with a page that solves a small proof of work in JavaScript (about 65,000 SHA-256 hashes, well under a second on a phone) and then sets a clearance cookie (__ews_clr, 30 minutes, bound to the client's /24 or /64 and to the distribution). Anything else that hits a challenge rule gets 403 {"error":"challenge_required"}, so API clients fail loudly instead of receiving HTML. It stops simple bots and scripts, not a headless browser.
Deutsche Cloud Core managed rules
Our own rules and engine, modelled on the OWASP Core Rule Set at paranoia level 1 — CRS-inspired, not CRS. Values are percent-decoded twice and lower-cased before matching; query, cookie and form values, the path, User-Agent, Referer and the first 16 KiB of a form, JSON, XML or text body are read (rules say which). A new web ACL blocks with the five injection groups and counts with scanners and protocol.
| Rule | CRS ancestor | What |
|---|---|---|
sqli-100 |
942100/942190 | UNION SELECT |
sqli-110 |
942130/942180 | Quote, then a boolean tautology (' OR 'a'='a) |
sqli-111 |
942130 | Numeric tautology closed by a comment (OR 1=1--) |
sqli-112 |
942150 | Quote, then OR TRUE / AND FALSE |
sqli-120 |
942350/942360 | Stacked query (; DROP TABLE …) |
sqli-130 |
942160/942170 | Time-based blind injection (SLEEP(, BENCHMARK(, WAITFOR DELAY) |
sqli-140 |
942140 | Schema probing (information_schema, pg_catalog, …) |
sqli-150 |
942440 | Quote closed by a SQL comment |
sqli-160 |
942151 | Error-based extraction functions (extractvalue(, updatexml() |
sqli-170 |
942480 | INTO OUTFILE |
sqli-180 |
942200/942370 | SELECT … FROM in a parameter |
xss-100 |
941110 | Script tag |
xss-110 |
941120 | Event handler attribute (onerror=, …) |
xss-120 |
941170 | javascript: and other script URL schemes |
xss-130 |
941160 | Active HTML tag (<iframe, <svg, <object, …) |
xss-140 |
941180 | DOM access typical of a payload (document.cookie, …) |
xss-150 |
941140 | CSS-based script execution |
traversal-100 |
930100/930110 | ../ |
traversal-110 |
930120 | Operating-system files (/etc/passwd, /proc/self/, …) |
traversal-120 |
930130 | Restricted files (.git/, .env, .htpasswd, credentials) |
traversal-130 |
920270 | NUL byte |
rce-100 |
932100/932105 | Unix command after a command separator |
rce-110 |
932160 | Unix shell path |
rce-120 |
932110/932120 | Windows command (cmd /c, powershell -enc) |
rce-130 |
932130 | Shell command substitution |
php-java-100 |
933100 | PHP open tag |
php-java-110 |
933200 | PHP stream wrapper (php://, phar://, …) |
php-java-120 |
933150/933160 | PHP code-execution function |
php-java-130 |
933170 | PHP object injection |
php-java-140 |
944150 | Log4Shell lookup (${jndi:…}), in every part incl. headers |
php-java-150 |
944100/944110 | Java code execution (Spring4Shell and others) |
scanners-100 |
913100 | Security scanner user agent (sqlmap, nikto, nuclei, …) |
protocol-100 |
911100 | Method not GET, HEAD, POST, PUT, PATCH, DELETE or OPTIONS |
protocol-110 |
920280 | Missing Host header |
protocol-120 |
920350 | Host header is a numeric IP |
protocol-130 |
920320 | Missing User-Agent |
protocol-140 |
920300/920380 | More than 255 arguments |
protocol-150 |
920170 | GET or HEAD with a body |
Start a new rule in count, read its matches in the WAF log for a while, then switch it to block. A false positive is fixed by excluding the rule id in that group ("exclude": ["sqli-180"]) or an allow rule in front of it.
What you see
- Per request (Monitoring → Logs, the distribution "(CDN)" in the source list; Request log on the distribution's Monitoring tab opens it): stream
accesswith status, cache outcome, timings, edge node; streamwaffor every match (action, rule, managed rule, field, the first 80 characters of the matched value, all matches of the request). About 50 lines per second are stored per distribution, WAF blocks first; kept 7 days. Client addresses are personal data — that is why they expire after 7 days. - Per minute (charted on the distribution's Monitoring tab; alarms in Monitoring → Alarms):
cdn_requests,cdn_cache_hits,cdn_cache_misses,cdn_hit_ratio,cdn_bytes_out,cdn_origin_bytes,waf_blocked,waf_counted,waf_challenged,waf_rate_limited.dcloud cdn distributions stats <id>sums them and shows each node's live counters. - Event bus:
ews.waf/CDN WAF Activityonce a minute per distribution with blocks (counts, top 10 rules, first 5 client addresses),LB WAF Activitythe same per application load balancer;ews.cdn/CDN Invalidation Completed. - After an update of the platform, an edge or load balancer node can run an older build for about two minutes. A rule it cannot read yet (a new statement type) is left out on that node only, and the web ACL's page says so ("not yet enforced on 1 of 2 nodes") until it has the new build; every other rule and tenant keeps working.
DDoS: what is and is not covered
Said plainly, because "DDoS protection" usually promises more than it delivers.
Hetzner filters volumetric attacks at the network level (layer 3/4: floods of UDP, SYN, amplification) for every address, automatically and at no charge. There is no SLA for it, no layer-7 filtering, and no report to us or you when it acts.
The Deutsche Cloud edge adds:
- SYN cookies on, a large SYN backlog and two SYN-ACK retries on every node, so a SYN flood that passes Hetzner's filter does not exhaust the connection table.
- nftables on every node, per source address on ports 80/443: at most 200 new connections per second (burst 400) and 512 concurrent connections; beyond that packets are dropped or the connection reset. Each node reports these settings and their counters every five minutes (
dcloud cdn edge list). - The proxy's own caps: 256 concurrent connections per client address (IPv6 per /64), 15 s to send request headers (against slow clients), and per distribution 10,000 connections, 10,000 requests/s sustained and 1,000 new TLS handshakes/s, so one distribution under attack cannot take the edge from the others.
- WAF rate rules and the challenge for layer-7 floods you can describe.
Not covered: there is no anycast and no scrubbing centre. An attack larger than what a node takes overloads the nodes it reaches. Measured on one edge node (a performance-4, inside a Hetzner location): about 138,000 cache hits per second (the network card's limit, with or without a web ACL), 1.7 GB/s of large objects, 17,800 new TLS connections per second, 30,000 misses per second, 148,000 blocked requests per second; a flood of random URLs fills the cache's memory budget and then evicts, it does not exhaust the node. DNS spreads viewers over two or three nodes only; a node that stops answering leaves DNS within 30 s (plus up to 30 s of resolver caching). If you expect attacks of that size, talk to us before relying on this.
Limits
| What | Limit |
|---|---|
| Per distribution | 1 origin, 10 aliases, 10,000 connections, 10,000 req/s (burst 20,000), 1,000 TLS handshakes/s |
| Cached object | 10 MiB; in memory, 3 GiB per edge node shared by all distributions |
| Web ACL | 100 rules, 10,000 CIDRs per rule, regex ≤ 512 characters, body inspection ≤ 64 KiB |
| Invalidation | 100 paths and tags per request; purges travel to the nodes for 24 h |
| Edge regions | de1 (Falkenstein + Nuremberg); fi1 (Helsinki) with the org setting |
| Viewers abroad | served from these locations too: no edge outside Germany (and Finland); outside Europe the round trip to Germany is added (roughly 90 ms from the US East Coast) |
Price
No base fee per distribution. Charged, on your invoice and in the cost explorer (service CDN / Web application firewall, one line per distribution and per web ACL):
| What | Price | SKU |
|---|---|---|
| Data delivered from the edge | €1 per TB (€0.001 per GB, 1 TB = 1,000 GB) | cdn.delivered.gb |
| Requests to the edge | €0.50 per 10 million | cdn.request |
| A web ACL | €3 a month (€0.00411 an hour it exists, at most €3 in a calendar month) | waf.web_acl.hour |
Delivered bytes and requests are counted on the edge nodes (cache hits and misses alike; delivered bytes are the response bodies served from the cache or the origin, without headers; requests the WAF blocks, rate-limits or challenges count as requests, their short answers are not charged as bytes) and billed per finished hour, about 20 minutes after it ends. The Cost card on a distribution's page shows this month so far, last month, what was delivered and requested this month, and what has been served since the last billed hour and is not billed yet (at list price); a web ACL's page shows its month against the €3 cap. Requests the WAF inspects cost nothing extra (we measured the managed rules at about €0.0006 of machine time per 10 million requests: not worth a price). Organisations on their own infrastructure pay the same: the edge is Deutsche Cloud's.
Where the prices come from: €1 per TB is what our provider charges us for traffic beyond what each edge machine includes (20 TiB a month), so delivered bytes are passed on at cost once that is used up; the included traffic and the request price carry the margin. One edge machine serves about 1.7 GB/s and 138,000 requests/s and costs €35.49 a month. If the provider's traffic price changes, ours follows. Above 10 TB in a month per organisation a second tier (€2 per TB) is planned and will be announced 30 days ahead; it is not in force.
The country data comes from DB-IP (IP to Country Lite, CC BY 4.0).