How to Point a Domain to BunnyCDN and Deploy It Using Stacking.Cloud

BunnyCDN is a powerful and affordable content delivery network that can help you serve your website efficiently.
This tutorial will guide you through setting up your domain on BunnyCDN, configuring DNS settings, adding a custom hostname, enabling SSL, and setting up edge rules for optimal redirection.

Step 1: Update Your Domain’s Nameservers

First, you need to point your domain to BunnyCDN by updating your nameservers in your domain registrar (e.g., NameSilo or Namecheap).

Steps to update nameservers:

  1. Log in to your domain registrar’s dashboard.
  2. Locate your domain and access the DNS or Nameserver settings.
  3. Replace the existing nameservers with BunnyCDN’s nameservers (see the example):
    • coco.bunny.net
    • kiki.bunny.net
  4. Save the changes.

Note: It may take a few minutes to a few hours for DNS changes to propagate. You can check the DNS propagation at https://dnschecker.org/

Step 2: Add Your Domain to BunnyCDN’s DNS Zone

Now, you need to set up the DNS records in BunnyCDN.


 

Steps to configure DNS:

  1. Log in to your BunnyCDN dashboard.
  2. In the sidebar, click on DNS.
  3. Click Add DNS Zone and enter your domain name (e.g., yourdomain.com).
  4. Add the necessary CNAME records:
    • Type: CNAME
      Host: @ (or leave blank for the root domain)
      Value: yourbunnycustomcdn.b-cdn.net
    • Type: CNAME
      Host: www
      Value: yourbunnycustomcdn.b-cdn.net
  5. Save the DNS records.

Step 3: Configure BunnyCDN Delivery Settings

Once the DNS is set up, you need to configure the content delivery settings.


Steps to set up the Pull Zone:

  1. In the BunnyCDN dashboard, go to CDN from the sidebar.
  2. Locate your Pull Zone (e.g., yourbunnycustomcdn.b-cdn.net).
  3. Click Add Custom Hostname.
  4. Add both:
    • yourdomain.com
    • www.yourdomain.com
  5. Enable Force SSL to ensure secure connections.
  6. Click Save.

Note: SSL certificates might take a few minutes to activate.

 

Step 4: Create Edge Rules for URL Redirection

To ensure proper URL redirection (e.g., forcing HTTPS and redirecting www to the root domain), you need to create an Edge Rule.


Steps to create an Edge Rule:

  1. In the BunnyCDN dashboard, navigate to Edge Rules.
  2. Click Create New Rule.
  3. Configure the following settings:
    • Actions:
      • Select Redirect to URL.
      • Value: https://yourdomain.com%{Url.Path}%{Request.QueryString?}
      • %{Url.Path}%{Request.QueryString?}
    • Conditions:
      • Select Request Header.
      • Header Name: host
      • Value: www.yourdomain.com
  4. Save the rule.

Step 5: Test Your Setup

After completing the setup, verify everything is working correctly.

  1. Open your browser and navigate to:
    • https://yourdomain.com
    • https://www.yourdomain.com
  2. Ensure the SSL certificate is active (check for the padlock icon in the address bar).
  3. Confirm that requests to www.yourdomain.com correctly redirect to yourdomain.com.

Conclusion

If you encounter any issues, clear your browser cache and DNS cache, or use DNS Propagation Checker to verify changes.