TechHow to Use Cloudflare and Bunny.Net CDN Together: A Step-by-Step Guide

How to Use Cloudflare and Bunny.Net CDN Together: A Step-by-Step Guide

Cloudflare undoubtedly provides the best security against DDoS attacks and offers advanced CDN features such as page rules, configuration rules, Rocket Loader, free SSL, and email obfuscation. However, it also has some drawbacks. Nearly 20% of websites on the Internet use Cloudflare CDN, making it overcrowded. Despite having hundreds of data centers, users sometimes experience downtime and very slow speeds. Moreover, Cloudflare’s pricing for features like video streaming and CDN storage can be quite high. In contrast, Bunny.net CDN offers similar features, except for page rules, configuration rules, and email obfuscation, for less than a dollar per month.

If you wish to use Cloudflare DNS and Bunny.net CDN together on a single domain, you are in the right place. In this post, we provide step-by-step instructions on implementing Cloudflare DNS and Bunny.net CDN together.

1. Setting up Cloudflare CDN

First, you need to create an account on Cloudflare if you don’t have one yet. Once you’ve created the account, add all the DNS records such as A, AAAA, CNAME, MX, and TXT. Do not add the sub-domain records for which you want to use Bunny.net CDN.

Update your nameservers to those provided by Cloudflare for your domain name. If you are using Cloudflare as your domain registrar, you don’t need to worry, as the records will be automatically updated.

2. Setting up Bunny.net CDN

Once you have created and set up your Cloudflare account and updated the nameservers for your domain name, the next step is to set up Bunny.net CDN.

Similar to Cloudflare, you need to create an account on Bunny.net CDN. Currently, Bunny.net CDN offers a 14-day free trial, allowing you to create an account without any cost or the need to add your card or payment methods.

You can directly use Bunny.net CDN for your domain name, but this will disclose your server’s origin IP address. To hide your IP address for specific subdomains, you need to use Bunny.net CDN’s DNS service.

Steps to Create DNS in Bunny.net for Subdomains:

  1. Log in to your Bunny.net Account:
    • Go to the Bunny.net website and log in to your account.
  2. Navigate to the DNS Management Section:
    • In the Bunny.net dashboard, find and select the “DNS” option from the main menu.
  3. Add a New Zone:
    • Click on the “Add Zone” button.
    • Enter your domain name in the provided field and click “Add Zone.”
  4. Configure DNS Records for Subdomains:
    • Once the zone is created, start adding DNS records for the specific subdomains you want to use with Bunny.net CDN.
    • Click on “Add Record” to create a new DNS record.
    • Specify the type (A or AAAA), the subdomain name, and the value (such as the IP address target provided by Bunny.net CDN).
    • Add all necessary records for the subdomains you want to use with Bunny.net CDN.

By following these steps, you can successfully set up Bunny.net DNS for specific subdomains, ensuring that your origin IP address remains hidden.

Steps to Create a Pull Zone in Bunny.net

Once you’ve successfully added the DNS records, it’s time to set up the CDN for the provided sub-domains. Follow these steps to create a Pull Zone in Bunny.net and integrate it with your sub-domains:

  1. Log in to your Bunny.net Account:
    • Go to the Bunny.net website and log in to your account.
  2. Navigate to the Pull Zones Section:
    • In the Bunny.net dashboard, find and select the “Pull Zones” option from the main menu.
  3. Add a New Pull Zone:
    • Click on the “Add Pull Zone” button.
    • Enter a name for your Pull Zone in the “Zone Name” field. This can be any name you choose.
  4. Configure the Pull Zone:
    • In the “Origin URL” field, enter the URL of your origin server. This is the source from which Bunny.net will pull content.
    • Set up any additional settings as required, such as Cache Expiry, Secure Token, or Custom Headers.
  5. Save the Pull Zone:
    • After entering the necessary details and configuring the settings, click on the “Add Pull Zone” button at the bottom of the page to save your new Pull Zone.
  6. Get the Bunny.net CDN URL:
    • Once the Pull Zone is created, you will be provided with a Bunny.net CDN URL.
    • Use this CDN URL to configure your subdomains or other elements you want to serve through Bunny.net CDN.

For detailed instructions, you can also refer to the Bunny.net support article on How to create your first Pull Zone.

By following these steps, you can successfully create a Pull Zone in Bunny.net and integrate it with your sub-domains, ensuring that your content is efficiently delivered through Bunny.net’s CDN while keeping your origin IP address hidden.

3. Adding Bunny.net CDN records to Cloudflare DNS

Once you have set up your Bunny.net account, including DNS and CDN records, you need to grab your unique CDN URL provided by Bunny.net and ensure SSL is enabled for both your main domain and the Bunny.net CDN’s unique CDN URL for your pull zone.

Steps to Integrate Bunny.net CDN with Cloudflare

  1. Log in to your Cloudflare Account:
    • Go to the Cloudflare website and log in to your account.
  2. Select Your Domain:
    • Choose the domain name you want to configure from your Cloudflare dashboard.
  3. Access DNS Records:
    • Navigate to the DNS records section.
  4. Add a CNAME Record:
    • Click on “Add Record” and select “CNAME” as the DNS type.
    • Enter your sub-domain in the “Name” field.
    • In the “Target” field, enter your Bunny.net CDN’s unique CDN URL.
    • Ensure that the Cloudflare proxy (orange cloud) is disabled for this record to prevent double CDN caching. This means you should see a gray cloud next to the record.
  5. Enable SSL:
    • Make sure SSL is enabled for both your main domain in Cloudflare and the Bunny.net CDN URL. This can typically be done through the “SSL/TLS” settings in both Cloudflare and Bunny.net dashboards.

Final Steps

By following these steps, you will configure your sub-domain to use Bunny.net CDN while still utilizing Cloudflare’s DNS and security features. This setup ensures that your website serves content efficiently from both Cloudflare and Bunny.net CDN.

Now your website is ready to deliver content using the combined power of Cloudflare and Bunny.net CDN, optimizing performance and security.

IR Digital Media Team
IR Digital Media Teamhttps://www.isrgrajan.com/
IR Digital Media Team is a member of Digital Pradesh, a collective of journalists, reporters, writers, editors, lawyers, advocates, professors, and scholars affiliated with the Digital Pradesh.

Latest Updates