How to set up a direct IP origin URL with a custom hostname using Edge Rules

This article explains two easy steps to connect your pull zone to your server IP directly, bypassing firewall services such as CloudFlare which can block our servers from accessing your data. 

1. Update your origin IP

The first thing we need to do is set the origin URL to point directly to your server's IP. You can do this by either creating a new pull zone or updating the existing one. Make sure that the correct scheme (HTTP or HTTPS) is selected in order to prevent any redirects and if enabled, make sure to disable the Forward Host Header feature.


This will now make your pull zone connect to your server directly, however the server will return the default website on that IP. To get content from your actual website, we have to configure BunnyCDN to send the correct hostname back to your origin server, which we will do in step 2.

2. Add the Edge Rule with the host value

To send the correct host header, open the Edge Rules page for your pull zone. Next, add an edge rule with the action type Set Request Header (1), header name to Host (2) and Header value as the hostname (domain name) where your website is accessible (3).

Scroll down the page, and setup the Condition Matching as below:

Set the IF statement to Request URL (1), and set the Match box to Match Any, and set the Match Criteria (2) to an * to indicate every request needs to be handled with this rule.

Once you've done that, click on "Add Edge Rule" and then proceed onto the instructions below to configure your hostname on the zone itself. 

3. Add the custom hostname to the zone

Now that we have configured BunnyCDN to send the right hostname back to your origin, we need to configure BunnyCDN to accept connections from your clients using the custom domain. To do this, first navigate to the Hostnames panel, and then enter your domain name into the Add Custom Hostname (1) section and click "Add Hostname". 

Once you have done this, you then need to go to your DNS provider and change the record so that (in my example here, is a CNAME that points to the BunnyCDN pull zone ( in this case). 

Once you have done this, you can enable the new custom hostname by going to the Linked Hostnames (2) and clicking the "Enable" button next to the new hostname you added. You can also get a free SSL certificate here if you want it. 


The only thing left to do is purge the cache if needed and your zone should now be connected to your server directly, serving from your own custom hostname. 

Table of Contents

Was this article helpful?
29 out of 44 found this helpful