> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bunny.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Direct IP Origin with Custom Hostname

> Connect your pull zone directly to a server IP address while serving content from a custom hostname using Edge Rules.

This guide explains how to connect your pull zone to your server IP directly, bypassing intermediary services (such as firewalls or proxies) that might block CDN access to your origin.

This is useful when:

* Your origin is behind a firewall that blocks CDN requests
* You need to bypass proxy services like Cloudflare
* You want to connect directly to a specific server IP

## Prerequisites

* A pull zone configured in the bunny.net dashboard
* Your origin server's IP address
* A custom hostname you want to use for serving content

## Configuration

<Steps>
  <Step title="Update your origin URL to the server IP">
    Navigate to your pull zone and go to **General** → **Origin**.

    Set the origin URL to point directly to your server's IP address:

    * Select the correct scheme (`HTTP` or `HTTPS`) to prevent redirects
    * If you have **Forward Host Header** enabled, disable it for this configuration

    <Note>
      At this point, your pull zone will connect to the server directly. However, the server will return the default website configured for that IP. Step 2 configures bunny.net to send the correct hostname to your origin.
    </Note>
  </Step>

  <Step title="Add the custom hostname to your pull zone">
    Go to **General** → **Hostnames** and add your custom hostname:

    1. Enter your domain name in the **Add a custom hostname** field
    2. Click **Add Hostname**
  </Step>

  <Step title="Configure DNS">
    Update your DNS provider to point your custom hostname to the bunny.net pull
    zone: - Create a **CNAME** record pointing to your pull zone hostname (e.g.,
    `your-zone.b-cdn.net`)
  </Step>

  <Step title="Enable SSL (optional)">
    After DNS propagation, you can enable SSL for your custom hostname:

    1. Click **Verify & Activate SSL** to get a free Let's Encrypt certificate
    2. Alternatively, scroll to **Linked Hostnames** and click **Enable** to activate SSL later or upload your own certificate
  </Step>

  <Step title="Create an Edge Rule to set the Host header">
    Navigate to **Edge Rules** and create a new rule to send the correct hostname to your origin:

    | Setting             | Value                                      |
    | ------------------- | ------------------------------------------ |
    | **Action**          | Set Request Header                         |
    | **Header Name**     | `Host`                                     |
    | **Header Value**    | Your origin hostname (e.g., `example.com`) |
    | **Condition**       | Request URL                                |
    | **Match Type**      | Match Any                                  |
    | **Condition Value** | `*`                                        |
  </Step>

  <Step title="Purge cache">
    If you had cached content from a previous configuration, purge the cache to ensure fresh content is fetched from the new origin.
  </Step>
</Steps>

## How it works

When a request comes in:

1. The client connects to your custom hostname (served by bunny.net)
2. bunny.net connects directly to your origin server IP
3. The Edge Rule sets the `Host` header so your origin knows which website to serve
4. Your origin responds with the correct content

This bypasses any intermediate proxies while maintaining proper hostname routing.

## Related

* [Variable Expansion](/cdn/edge-rules/variable-expansion) - Use dynamic values in your Edge Rules
* [Rule Ordering](/cdn/edge-rules/ordering) - Understand how multiple rules interact
