Why the origin needs its own protection
A CDN sits in front of your site, but it does not stand between your server and the internet. The origin still has a public address, and anything sent to that address reaches your server untouched: the WAF never sees it, rate limits never count it, the cache never absorbs it.
That is why serious attacks go looking for the origin. A flood of requests that rate limits would have slowed lands on one server; an exploit the WAF would have blocked reaches the application; a scraper the bot check would have stopped downloads everything. Origin protection closes that side door, in two halves: lock the origin so that it answers only the CDN, and hide it so that fewer people know where to knock.
Lock 1: a secret header on every rule
The simplest lock is a shared secret. You choose a header name and a long random value, the CDN adds the header to every request it sends to your origin, and your origin rejects every request without it. Whoever does not know the value is turned away before your application runs.
On cdn.com.tr you add it in the Headers sent to your origin field of each delivery rule, one header per line: the name, a space, then the value. The name and the value are yours to choose; make the value at least 32 random letters and digits. On rules that connect to your origin over HTTPS, the header travels encrypted.
Roll it out in order: add the header to every rule, point your domain at the CDN, confirm that requests arrive with it, then switch the check on. When you add a rule later, add the header there too. To change the secret, accept both the old and the new value for a while, update the rules, then drop the old one.
nginx and Apache: reject requests without the secret header
# nginx, inside the server block
if ($http_x_origin_auth != "your-long-random-value") {
return 403;
}
# Apache, in the virtual host or .htaccess
RewriteEngine On
RewriteCond %{HTTP:X-Origin-Auth} !=your-long-random-value
RewriteRule ^ - [F]
Lock 2: mTLS, authenticated origin pull
With mTLS the CDN proves itself with a certificate instead of a header value. Your origin requires a client certificate signed by the CDN's certificate authority, and a connection without one is refused during the TLS handshake, before a single HTTP request is read.
On cdn.com.tr this is authenticated origin pull, a card on your account's Origin page. On every paid plan the edges present the CDN.com.tr certificate (CN=origin-pull.cdn.com.tr), which proves a request comes from CDN.com.tr's edge servers; keep your secret header next to it, because the header is what marks the requests as yours. On Enterprise plans you can choose a certificate issued for your account alone, whose name is your account ID. Your origin needs an HTTPS port of its own, and the card gives you the CA bundle and the exact name to accept.
Together, a certificate and a header make a strong pair: the certificate is checked in the TLS layer and cannot be copied out of a log, and the header ties the request to your account.
Lock 3: a firewall allow-list
A firewall rule that accepts the web ports only from the CDN's edge addresses stops direct requests before they reach the web server, and keeps port scanners from learning what runs there. It makes a good second layer.
On cdn.com.tr we give you the current addresses of the edge servers linked to your account on request. Make the secret header or the certificate your primary lock and the allow-list the second one: the first two keep working whatever happens to addresses, while a list needs to be kept up to date. Keep your own management access (SSH, a VPN, your office address) in a separate rule, so that updating the list can never lock you out.
ufw: web ports only from the edge (example addresses)
# allow the edge addresses (example values)
sudo ufw allow from 203.0.113.0/24 to any port 80,443 proto tcp
sudo ufw allow from 2001:db8:100::/48 to any port 80,443 proto tcp
# then refuse everyone else on the web ports
sudo ufw deny 80/tcp
sudo ufw deny 443/tcp
Hide the origin IP
Locks make the origin refuse strangers; hiding it means fewer strangers try. Origin addresses leak in a handful of predictable places.
DNS records and their history. Once the site is on the CDN, no public record should point at the origin. Check the apex, www, and forgotten names such as dev, staging, ftp or cpanel. DNS history services remember old records, so if the origin address was ever published, the reliable fix is a new address for the origin after the move.
Mail. Mail sent from the web server carries its address in the Received headers. Send mail through a separate mail service or relay rather than from the origin, and keep the origin address out of your MX and SPF records.
The application. Error pages, debug output and status pages can print the address, and features that fetch a URL the visitor supplies (webhooks, link previews, image imports) make the origin call out from it. Switch debug output off in production and send outgoing requests through a separate address where you can.
Scans. Internet-wide scanners record which certificate every address presents. An origin that shows your site's certificate to anyone who connects can be found that way, which is one more reason to require the header or mTLS and to firewall the web ports.
Let the edge do the filtering
With the origin locked, every request passes through the edge, and the edge's protections apply to all of them. On cdn.com.tr that means the WAF, with exceptions you set for a WAF rule on a given path, rate limiting per rule, IP, country and ASN lists, a JavaScript challenge for browser traffic, and a cache that answers repeat requests without touching your server. During an attack your origin sees only what passed all of them.
Two settings complete the picture. Read the visitor's address from the X-CDN-Client-IP header rather than from the connection, as the real visitor IP guide shows, so your logs and application limits see visitors rather than edges. And give slow endpoints the origin timeout they need in their rule, so they are not cut off with a 504.
A rollout checklist
1. Put the site on the CDN and confirm everything works through it.
2. Add the secret header to every delivery rule; if you use mTLS, choose the client certificate too.
3. Configure the origin to check the header (and the certificate) without enforcing yet.
4. Enforce, then test both ways: through the CDN you get your page; straight to the origin you get 403, or the handshake fails.
5. Add the firewall allow-list with the edge addresses as a second layer.
6. Clean up DNS records, mail and debug output that reveal the origin; if the old address was ever public, move the origin to a new one.
7. Change the secret from time to time, and add the header to every new rule.
Test the lock from both sides
# through the CDN: your page
curl -sI https://www.example.com/
# straight to the origin: 403, or a refused handshake with mTLS
curl -skI --resolve www.example.com:443:ORIGIN_IP https://www.example.com/
Who locks the origin
Logins and checkouts reachable only through the WAF and rate limits that protect them.
Every API call passes the edge, so limits and blocks apply to all clients alike.
The edge filters the traffic while the origin answers only requests that passed every check.
How to set it up
Step-by-step guides in the help centre:
Origin protection FAQ
Is hiding the origin IP enough?
No. Hidden addresses get found, through old DNS records, mail headers or scans. Treat hiding as a bonus and locking as the protection: with a secret header or mTLS, a found address is of no use.
Secret header or mTLS: which should I use?
Start with the secret header: it works on any server and any plan. Add mTLS when you also want the check in the TLS layer. With the shared CDN.com.tr certificate keep the header as well, because the header is what identifies your account.
Where do I get the edge addresses for my firewall?
We give you the current addresses of the edge servers linked to your account on request. Use them as a second layer behind the secret header or mTLS, so your protection never depends on a list being up to date.
What happens to requests that do not come through the CDN?
With the header check, nginx or Apache answers 403. With mTLS required, the TLS handshake fails before any request is read. Either way the request never reaches your application.
Should I still restrict SSH and admin panels?
Yes. Origin protection covers the web ports. Keep SSH, databases and admin tools behind their own rules: a VPN, a bastion host or your office addresses only.
How do I check that the lock works?
Send one request through the CDN and one straight to the origin with curl's --resolve option. The first must succeed and the second must be refused. Repeat the test whenever you add a rule.