---
title: "Cloudflare & Bunny"
url: https://howthewebworks.org/lessons/06-cloudflare-bunny
lang: en
---

[Course](https://howthewebworks.org/index.html) · Lesson 6 of 7

# Cloudflare & Bunny

Cloudflare and bunny.net can manage your DNS and deliver your website faster. Compare their approaches and follow the steps to set up DNS, website acceleration and HTTPS.

* 25 minutes
* 1 exercise, 6 quiz questions

## After this lesson, you can

* separate DNS management from website acceleration
* compare Cloudflare and bunny.net for your website
* set up DNS with either service and check HTTPS
* deliver files through Bunny CDN without moving DNS
* tell browser, CDN and hosting caches apart and refresh them

## First, separate DNS from website traffic

A **DNS provider** stores the records that connect names to addresses and services. A **proxy** is an intermediary: the visitor requests a page there, and the proxy contacts the original web server if needed. That original server at your hosting company is called the **origin server**.

A **cache** is a saved copy of something, such as an image. A **CDN** (Content Delivery Network) is a network of servers that delivers website files to visitors, often from a nearby location. By keeping copies, it needs to contact your hosting server less often.

DNS management and a CDN are different jobs. You can use one service for both, but you do not have to. Moving DNS to another provider does not, by itself, send your website traffic through a CDN.

## Where do Cloudflare and Bunny fit?

Choose a setup and follow the path of one image.

### 1First: look up the address

**Browser and resolver**Find the address for the name

**Cloudflare DNS**Returns Cloudflare’s address

DNS tells the browser where to go; the image does not travel through DNS.

### 2Then: fetch the image

A usable copy is already in the CDN cache

### Follow the image

Without a CDN, the browser asks the hosting server for the image directly. A proxy server such as Bunny or Cloudflare can fetch and forward it instead. A usable copy in the CDN cache can avoid a new request to the hosting server.

This diagram uses HTTPS on both connections. The visitor certificate and the hosting certificate are checked separately.

## Comparing Cloudflare and bunny.net

Cloudflare & Bunny: What do you want to do?, Cloudflare, bunny.net

| What do you want to do? | Cloudflare | bunny.net |
| --- | --- | --- |
| Manage DNS | Add records and change the nameservers to Cloudflare at your registrar. | Add records in Bunny DNS and change the nameservers to Bunny. |
| Send website traffic through a CDN | Set web records to **Proxied**: visitors then reach the website through Cloudflare. | Create a **Pull Zone**: the settings that tell Bunny where to fetch files and how to deliver them. Or use **CDN Acceleration** in Bunny DNS to create that connection. |
| Keep your current DNS provider | The standard setup below uses Cloudflare nameservers. | Use a CNAME for a name such as `cdn.example-bakery.nl`. Bunny DNS is not required. |
| Use HTTPS | A certificate for visitors and an encrypted, validated connection to your hosting server. | A certificate for your CDN name and HTTPS with certificate validation to your hosting server. |

Want your whole website to go through Cloudflare? Follow the Cloudflare steps. Want to start by serving images and other files through Bunny? Follow the Bunny CDN steps; you can keep your current DNS provider.

## Cloudflare: DNS only or Proxied

A Cloudflare record has five fields. What this course has called Value so far is called **Content** there.

Cloudflare & Bunny: Type, Name, Content, Proxy status, TTL

| Type | Name | Content | Proxy status | TTL |
| A | @ | 203.0.113.10 | Proxied | Auto |
| CNAME | www | example-bakery.nl | Proxied | Auto |
| MX | @ | mail.postman.example | DNS only | Auto |

### Proxied or DNS only

* **Proxied:** a lookup returns a Cloudflare IP address instead of the origin server's address. Cloudflare can filter attacks and cache files. What it caches depends on your settings.
* **DNS only:** ordinary DNS without a web proxy. The record returns the configured address or name.
* Only A, AAAA and CNAME can be Proxied. MX and TXT are always DNS only.
* The standard proxy is for HTTP and HTTPS traffic. A hostname that a mail app connects to, such as `mail.example-bakery.nl`, should therefore be DNS only.
* A Proxied record has an Auto TTL. Cloudflare currently uses 300 seconds: five minutes.

Exercise

Interactive exercises need JavaScript. You can still read the explanations above.

### SSL/TLS mode

**SSL** (Secure Sockets Layer) is the old predecessor of TLS, the technology securing HTTPS. The name SSL still appears in settings such as this menu. Secure connections use TLS.

With the proxy enabled, there are two connections: visitor to Cloudflare, and Cloudflare to the origin server. The mode determines how the second connection works.

* **Flexible:** Cloudflare talks to the server without encryption. Avoid this. If the server redirects everything to HTTPS, the browser can get stuck in a redirect loop.
* **Full:** encrypted, but the server's certificate is not validated.
* **Full (strict):** encrypted and validated. This is the mode to aim for once the server has a valid certificate.

Always check the selected mode yourself. For Full (strict), the certificate must be valid, cover the hostname and be trusted by Cloudflare.

## Step by step: DNS, CDN and HTTPS with Cloudflare

1. **Save your current settings.** Make a copy of every DNS record. Check that your hosting server can deliver the website with a valid HTTPS certificate.
2. **Add your domain.** Let Cloudflare scan for records and compare the result with the old DNS zone: the collection of records for your domain. Add missing records, including MX, TXT and subdomains. Keep web records on **DNS only** for now, so visitors continue to reach your existing hosting.
3. **Prepare DNSSEC.** Follow the [migration steps in lesson 2](https://howthewebworks.org/lessons/02-dns-records.html#dnssec-verhuizen). Remove the old DS record through the registrar and wait for cached DS answers to expire. Keep signing at the old provider until then.
4. **Change the nameservers.** At the registrar, enter exactly the nameservers Cloudflare shows for your domain. Keep the old DNS zone available while old references may still be cached.
5. **Check HTTPS before enabling the proxy.** Under **SSL/TLS → Overview**, select **Full (strict)**. Under **Edge Certificates**, check that the visitor certificate is active and covers your website names. Then set the desired A, AAAA or CNAME web records to **Proxied**. Mail hostnames stay DNS only.
6. **Test the website.** Open pages and images over HTTPS. If all affected web hostnames support HTTPS, enable **Always Use HTTPS** under **SSL/TLS → Edge Certificates** to redirect HTTP visitors to HTTPS. Check the redirect, sign-in and forms.
7. **Finish the DNS move.** Test incoming and outgoing email and your subdomains. Wait for old nameserver references to expire. Then enable DNSSEC in Cloudflare, publish the new DS record at the registrar and verify it works.

These steps do not move your domain registration or hosting. They change who answers DNS queries and, with Proxied enabled, who receives website traffic.

### Why can Cloudflare put a CNAME at the root domain?

The Cloudflare dashboard lets you configure a CNAME at the root domain (`@`). It uses **CNAME flattening**: Cloudflare looks up the target name's IP addresses itself. Queries for your domain then receive A or AAAA records, not a CNAME.

The required NS and SOA records can remain. The DNS rule from lesson 2 still applies. Other providers sometimes offer similar features called ALIAS or ANAME.

## Step by step: DNS with bunny.net

You only need this if you want Bunny to manage DNS too. For the CDN steps that follow, you can keep your current DNS provider.

1. **Save all current records.** Make a copy at your existing DNS provider, including email records and subdomains.
2. **Add a DNS zone.** In the Bunny dashboard, choose **DNS → Add DNS Zone** and enter your domain name. Let Bunny find existing records or import your exported zone file. Compare the result with your copy and add missing records. Leave **CDN Acceleration** off for now: move DNS first.
3. **Prepare DNSSEC.** Use the same [DNSSEC migration steps](https://howthewebworks.org/lessons/02-dns-records.html#dnssec-verhuizen): remove the old DS record, let cached answers expire and keep the old signing active until then.
4. **Change nameservers at the registrar.** Copy the names Bunny shows for your zone. Keep the old zone available and check the website, email and subdomains.
5. **Enable DNSSEC again.** Wait for old nameserver references to expire. Enable DNSSEC under **Security** in your Bunny DNS zone and publish the displayed DS record at your registrar. Then verify that DNSSEC works.

Your website files remain at the same hosting company. Only the DNS answers now come from Bunny.

## Step by step: files through Bunny CDN and HTTPS

We will create a new name for images and other files: `cdn.example-bakery.nl`. The main website stays at `example-bakery.nl`. A **custom hostname** is a name you own and connect to the CDN.

1. **Check the source.** Open an existing file over HTTPS on your hosting server, such as `https://example-bakery.nl/logo.png`. It must work with a valid certificate.
2. **Create a Pull Zone.** Choose **CDN → Add Pull Zone**, give it a name and enter the website address as the **Origin URL**: the address where Bunny fetches files. In our example, this is `https://example-bakery.nl`. Use HTTPS and enable origin certificate verification. Note the assigned name ending in `.b-cdn.net`.
3. **Connect your own CDN name.** In the Pull Zone, add `cdn.example-bakery.nl` under **General → Hostnames**. At your current DNS provider, create a CNAME named `cdn` pointing to the assigned `.b-cdn.net` name. Using Cloudflare DNS? Set this record to **DNS only**, so Cloudflare does not put another proxy in front of Bunny.
4. **Activate HTTPS.** Wait for DNS to return the new connection. Activate the free certificate for the linked hostname with **Enable SSL**. Wait until it is active, then test `https://cdn.example-bakery.nl/logo.png`. Both the visitor-to-Bunny connection and the Bunny-to-hosting connection must use HTTPS.
5. **Make the website use the CDN name.** Update file addresses in your website or its plugin’s CDN setting. For example, the logo’s address becomes `https://cdn.example-bakery.nl/logo.png`. Adding a CNAME alone does not change file addresses on your pages.
6. **Check delivery.** Open the [browser tools](https://howthewebworks.org/lessons/07-troubleshooting.html#browsertools) and check under **Network** that files come from the CDN name. Look at the response’s extra information, its **headers**: Bunny may include `cdn-cache`. `HIT` means Bunny served a saved copy; `MISS` means it did not have one.

This route changes no nameservers or email records. Only use the new CDN name on your website once HTTPS works. Moving an existing, busy HTTPS hostname needs extra preparation: Bunny explains how to [issue a certificate before switching](https://bunny.net/docs/cdn/seamless-migration), so you do not have to wait for HTTPS during the move.

### What if the whole website should go through Bunny?

If Bunny already manages your DNS, **CDN Acceleration** can connect a web record to a new Pull Zone and arrange a visitor certificate. First check that Bunny’s nameservers are active. Then enable the setting on the web record and check the linked Pull Zone. Leave email hostnames out of this setting.

The origin must still reach your hosting server after the website name points to Bunny. Otherwise, Bunny keeps requesting the page from itself. Check HTTPS and certificate verification to the origin, and test images, forms and sign-in. Personal pages and baskets must not be served to other visitors as shared copies.

A new visitor certificate may take time to become active. For an existing HTTPS hostname that must stay available, use the [prepared migration with a manual Pull Zone](https://bunny.net/docs/cdn/seamless-migration) instead: issue the certificate first, then switch DNS to that Pull Zone. Do not also enable automatic CDN Acceleration for the same hostname; a hostname can belong to only one Pull Zone.

## Caching: why can't I see my change?

A **cache** is a saved copy. It avoids fetching or generating a file or page again for every request. That speeds up a website, but an old copy can hide a change.

The DNS cache stores answers about names and addresses. The caches below store website content. Lowering the DNS TTL does not refresh an old image.

* **Browser cache:** on the visitor's device, for example a copy of a stylesheet.
* **CDN cache:** at Cloudflare or Bunny, reducing requests to the hosting server.
* **Hosting or plugin cache:** at the website itself, for example a pre-generated page. Your host and a WordPress plugin can each have their own cache.

The browser first checks whether it has a usable copy. If not, the request continues to the CDN and, if needed, the hosting server. Each layer can still return an old version.

### Refresh the right copy

The bakery has uploaded a new logo. You see it, but the client sees the old one. First, check that you are opening the same address and which file the browser actually receives.

1. **Test without the browser cache.** In Chrome, open the browser tools by right-clicking the page and choosing **Inspect**. Select **Network**, the tab listing requested pages and files. Enable *Disable cache* to stop using copies from the browser cache, then reload. This applies while the tools are open. CDN and hosting caches remain active.
2. **Check the website itself.** Is the change really on the server? If needed, refresh the plugin and hosting caches for the changed content first.
3. **Then refresh the CDN.** Removing saved copies is called a *purge*. In Cloudflare, prefer purging only the affected URL. In Bunny, **Purge Cache** in the Pull Zone clears the whole zone by default. For more targeted removal, follow the [purge guide](https://bunny.net/docs/cdn/purge-cache). Purge the hosting cache first, or the CDN may fetch another old copy.
4. **Check again.** Reload without the browser cache and inspect the content returned. Purging the CDN does not remove copies already cached on visitors' devices.

For changed CSS or JavaScript, a new filename such as `style-v2.css` helps request a fresh file. The page must then reference that new name.

### What do the headers tell you?

**Headers** are extra information attached to an HTTP request or response. Find them by selecting a request in the [browser tools](https://howthewebworks.org/lessons/07-troubleshooting.html#browsertools).

* `Cache-Control: max-age=3600`: this response may be considered fresh for an hour. A copy that is already older has less time left.
* `Cache-Control: no-cache`: storage is allowed, but the cache must check that the copy is still valid before reusing it.
* `Cache-Control: no-store`: do not store this response in a cache.
* `CF-Cache-Status: HIT`: Cloudflare served a cached copy. `MISS` means there was no matching copy and Cloudflare fetched the content from the origin.
* `cdn-cache: HIT`: Bunny served a saved copy. `MISS` means it had to fetch the file; `BYPASS` means it bypassed the cache for this request.

A `MISS` does not prove that the hosting server generated fresh content: it may have its own cache. Do not casually cache personal pages, baskets or checkout pages for all visitors. What the CDN caches depends on your cache rules.

Quiz

Interactive exercises need JavaScript. You can still read the explanations above.

## What to remember

* DNS management and a CDN are separate jobs; moving DNS does not move your website files.
* Cloudflare uses Proxied for web records. Use Full (strict) and check the visitor certificate.
* Bunny CDN can use a custom CDN name and a CNAME at your current DNS provider. Connect the name, set up HTTPS and then update file addresses.
* A nameserver change requires every record and the right sequence for setting up DNSSEC again.
* For stale content, refresh the relevant hosting cache first, then the CDN cache. The browser may still have its own copy.

Sources and further reading

Content reviewed on 26 November 2026. These sources are in English.

* [Cloudflare: proxy and DNS only](https://developers.cloudflare.com/dns/proxy-status/)
* [Cloudflare: CNAME flattening](https://developers.cloudflare.com/dns/cname-flattening/)
* [Cloudflare: setting up DNSSEC](https://developers.cloudflare.com/dns/dnssec/)
* [Cloudflare: Full (strict)](https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/full-strict/)
* [Cloudflare: TTL](https://developers.cloudflare.com/dns/manage-dns-records/reference/ttl/)
* [MDN: HTTP caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching)
* [MDN: Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)
* [Cloudflare: purging the cache](https://developers.cloudflare.com/cache/how-to/purge-cache/)
* [Cloudflare: CF-Cache-Status](https://developers.cloudflare.com/cache/concepts/cache-responses/)
* [Cloudflare: add a domain](https://developers.cloudflare.com/fundamentals/manage-domains/add-site/)
* [Cloudflare: Always Use HTTPS](https://developers.cloudflare.com/ssl/edge-certificates/additional-options/always-use-https/)
* [bunny.net: DNS setup](https://bunny.net/docs/dns/quickstart)
* [bunny.net: DNSSEC](https://bunny.net/docs/dns/dnssec)
* [bunny.net: Pull Zones](https://bunny.net/docs/cdn/quickstart)
* [bunny.net: HTTPS](https://bunny.net/docs/cdn/ssl-setup)
* [bunny.net: CDN Acceleration](https://bunny.net/docs/cdn/cdn-acceleration)
* [bunny.net: prepare HTTPS before a move](https://bunny.net/docs/cdn/seamless-migration)
* [bunny.net: purge cache](https://bunny.net/docs/cdn/purge-cache)
* [bunny.net: origin certificate verification](https://bunny.net/blog/origin-ssl-certificate-verification/)
