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

---
id: 478bf7b1-0607-45e6-ab14-7b4eb2b61ae2
---

# Set up a reverse proxy with HubSpot

> Step-by-step instructions for configuring a reverse proxy with HubSpot, including provider-specific guidance for Amazon CloudFront and nginx.

This guide walks through the process of setting up a reverse proxy with HubSpot. This process includes the following steps:

* [Configure the proxy](#configure-the-proxy) in your external environment.
* [Confirm that the configuration is correct](#confirm-the-configuration-is-correct).
* [Added the domain to HubSpot](#add-the-domain-to-hubspot) to enable content publishing.

The guide includes general instructions as well as provider-specific instructions for [nginx](#set-up-a-reverse-proxy-using-nginx), [Amazon CloudFront](#set-up-a-reverse-proxy-in-amazon-cloudfront), and [Cloudflare's Orange-to-Orange](#set-up-a-reverse-proxy-with-cloudflare-orange-to-orange).

## Before you begin

Review the prerequisite sections below for guidance applicable to all providers, along with Cloudflare-specific information if you're setting up a reverse proxy using Cloudflare's Orange-to-Orange (O2O) configuration.

### General prerequisites

Before proceeding, ensure you've reviewed the [reverse proxy overview](https://developers.hubspot.com/docs/cms/best-practices/testing-staging-performance/reverse-proxies/overview.md) to:

* Confirm a reverse proxy is [the right solution for your use case](https://developers.hubspot.com/docs/cms/best-practices/testing-staging-performance/reverse-proxies/overview.md#when-to-use-a-reverse-proxy).
* Understand [how reverse proxies work with HubSpot](https://developers.hubspot.com/docs/cms/best-practices/testing-staging-performance/reverse-proxies/overview.md#how-it-works-with-hubspot).
* Review the [considerations and trade-offs](https://developers.hubspot.com/docs/cms/best-practices/testing-staging-performance/reverse-proxies/overview.md#considerations).
* Verify you meet the [prerequisites](https://developers.hubspot.com/docs/cms/best-practices/testing-staging-performance/reverse-proxies/overview.md#prerequisites), including having a CDN or distributed computing environment.

> [!WARNING]
>
> **Please note:** reverse proxy setup is not supported by HubSpot's support team. For implementation help, check out HubSpot's [Community forums](https://community.hubspot.com/c/develop-build-integrate/58) or the [Solutions Directory](https://ecosystem.hubspot.com/marketplace/solutions) to find a HubSpot partner.

### Cloudflare prerequisites

> [!NOTE]
>
> A *Cloudflare Enterprise* account is required to set up an [Orange-to-Orange (O2O)](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/saas-customers/provider-guides/hubspot/) reverse proxy configuration for HubSpot.

Before making any DNS changes or configuring Cloudflare, verify the following:

#### Check for Cloudflare zone holds

Cloudflare's **zone hold** feature is a security setting that prevents other Cloudflare zones from adding a customer's domain. If zone hold is enabled on your domain, **HubSpot's hostname validation will fail** — even after you add the proxy CNAME record. This is because the zone hold blocks the hostname from being validated through Cloudflare's infrastructure.

**To check if zone hold is enabled:**

1. Log in to your Cloudflare account.
2. Navigate to the zone for your domain.
3. Go to **Overview** or check your account-level security settings.
4. Look for the **Zone Hold** setting. If it is enabled, you must disable it before proceeding with the reverse proxy setup.

If you are unsure whether zone hold is enabled, contact your Cloudflare account team or check with your internal DNS administrator.

#### Understand hostname verification with Cloudflare O2O

With a standard reverse proxy (e.g., nginx or Apache), you can typically pre-verify a hostname before making DNS changes using a TXT or HTTP validation token. **This is not possible when your domain is already on Cloudflare.**

When your domain is managed by Cloudflare:

* Hostname pre-validation via TXT or HTTP token is **not supported** for O2O custom hostnames. Cloudflare detects that the domain is already on their network and requires DNS-based activation instead.
* The hostname will **only be verified** once a proxied (orange-clouded) CNAME record is added pointing to the appropriate HubSpot zone.
* If your domain is currently hosted elsewhere and you attempt to use a reverse proxy like nginx or Apache to forward requests to HubSpot's zone, **this will not work** and will result in an error.
* The **only way** to activate the hostname is to add the orange-clouded CNAME record pointing to your HubSpot zone.

> [!WARNING]
>
> The CNAME record for the subdomain you're connecting to HubSpot must point to HubSpot's zone with the Cloudflare orange cloud enabled. If you need to keep serving some traffic from your existing hosting provider, see the [path-based proxying with DNS override](#3-path-based-proxying-with-dns-override-optional) approach below, which uses a separate subdomain and a Cloudflare origin rule to route only specific paths to HubSpot.

## General instructions

The steps below provide high-level guidance across all providers. It's recommended you review each of the sections below, then proceed with the [provider-specific instructions](#provider-specific-instructions) tailored to specific third-party providers, if applicable.

### Configure the proxy

Adding a custom reverse proxy means that users of your website will make a request to your service, then be proxied through to HubSpot's CDN.

To begin setting up the proxy, first configure it in your external environment, such as a CDN like [Amazon CloudFront](#set-up-a-reverse-proxy-in-amazon-cloudfront) or [Cloudflare](#set-up-a-reverse-proxy-with-cloudflare-orange-to-orange), or an [nginx](#set-up-a-reverse-proxy-using-nginx) server.

> [!NOTE]
>
> You should always implement the proxy in a load balanced environment so that traffic from your proxy rotates requests to the HubSpot origin domain from multiple IP addresses.

The domain needed for the proxy will be in the following format: `<HubID>.<suffix>`. The suffix value is determined by your account's [assigned data center](https://knowledge.hubspot.com/account-security/hubspot-cloud-infrastructure-and-data-hosting-frequently-asked-questions#how-can-i-check-my-data-center-and-where-my-account-data-is-hosted). For accounts on the US East (NA1) data center, you'll also need to append a number to the suffix, based on the last two digits of your Hub ID.

Use the tables below to find the correct suffix along with the correct numbers to include in the suffix.

**Suffixes by data center**

| Data center | Suffix |
| - | - |
| US East | `sites-proxy.hscoscdn[##].net` |
| US West | `sites-proxy.hscoscdn-na2.net` |
| Canada | `sites-proxy.hscoscdn-na3.net` |
| European Union | `sites-proxy.hscoscdn-eu1.net` |
| Australia | `sites-proxy.hscoscdn-ap1.net` |

**Suffix numbers by Hub ID (US East only)**

For accounts on the US East (NA1) data center, append a number to the suffix based on the last two digits of your Hub ID.

| HubIDs ending with | Suffix number |
| - | - |
| 00-10 | `00` |
| 11-19 | `10` |
| 20-29 | `20` |
| 30-39 | `30` |
| 40-49 | `40` |
| 50-59 | `00` |
| 60-69 | `10` |
| 70-79 | `20` |
| 80-89 | `30` |
| 90-99 | `40` |

For example, if your Hub ID is `123456` and is hosted in the US East data center, the correct origin domain would be `123456.sites-proxy.hscoscdn00.net`.

Once you've noted the correct domain to use, continue reading for general instructions for configuring a reverse proxy, as well as specific guidance for [nginx](#set-up-a-reverse-proxy-using-nginx), [Amazon CloudFront](#set-up-a-reverse-proxy-in-amazon-cloudfront), or [Cloudflare](#set-up-a-reverse-proxy-with-cloudflare-orange-to-orange).

In general, you can configure your proxy to forward requests using your origin CNAME and adding the following configuration settings:

1. Set your proxy to perform no caching for paths originating from HubSpot. HubSpot automatically manages the content of our CDN's cache so pages are updated automatically when content is published. Note that if the service caches responses, pages may not update for hours or days.
2. Add or prepend to a ​`X-Forwarded-For`​ header with the client IP address of the original requestor. This is required to differentiate clients from each other. Many services such as CloudFront maintain these headers automatically.
3. To ensure personalized content based on location works, pass a static header of `X-HubSpot-Trust-Forwarded-For: true`​. This will trust the `​X-Forwarded-For​` header, which may not have been updated by all upstream proxies.
4. Pass a ​`X-HS-Public-Host`​ header with a value of your destination domain.
5. Allow all HTTP methods.
6. Ensure an SSL certificate is provisioned and installed for your proxy domain.
7. Forward all query strings.
8. Forward ​all​ other request and response headers as-is, including cookies.
9. Ideally, all paths under your domain should proxy to HubSpot. If that's not the case, then the following paths must proxy so assets load properly from your domain:
   * `/_hcms/*`
   * `/hs/*`
   * `/hubfs/*`
   * `/hs-fs/hubfs/*`
   * `/hs-fs/*`
   * `/cs/c/*`
   * `/e3t/*`
   * `/events/*`

> [!NOTE]
>
> The `hs-fs/hubfs/*` path was added as of December 20, 2024, and replaces the `hs-fs/hub/*` path. Your reverse proxy configuration should allow for the new path, and you may want to update any hard-coded references to the old path to avoid redirects. Learn more in the [developer changelog](https://developers.hubspot.com/changelog/cdn-path-for-static-assets-css-javascript-changing).

### Confirm the configuration is correct

You can identify configuration issues in your HubSpot domain settings:

* In your HubSpot account, click the **settings icon** in the main navigation bar.
* In the left sidebar menu, navigate to **Website** > **Domains & URLs**.
* Next to the domain you are using for your reverse proxy, click the **Edit** dropdown menu and select **Verify Reverse Proxy Connection**.
* Click any **category** that is labeled as *Failed* to view recommendations for fixing the issue.
* Once you've implemented your fixes, click **Refresh test** to check your configuration again.

> [!WARNING]
>
> If you receive an error in your domain settings stating that “Reverse proxy domains need your action to avoid website disruption,” learn how to [set up a Domain Control Validation (DCV) record](https://knowledge.hubspot.com/domains-and-urls/ssl-and-domain-security-in-hubspot#set-up-a-domain-control-validation-dcv-record).

To further confirm your configuration, visit: `https://[yourFullDomain]/_hcms/diagnostics` and verify the following information:

* The current time value changes on every load. This confirms that the page is not cached.
* The `User-Agent` is consistent with your browser.
* The `Accept-Language` value is consistent with your browser.
* The `Accept-Encoding` header is `*`. This ensures that responses are compressed.
* The `Cookie` value is not blank.
* The `Protocol` is `https`.
* The leftmost IP address in `X-Forwarded-For` matches your IP address as reported by a service like [https://www.whatismyip.com](https://www.whatismyip.com/).
* The `IP-Determined Location` values are accurate to your location. These are based on the IP-related headers in `X-Forwarded-For`.

> [!WARNING]
>
> If you encounter a `404` error when visiting the diagnostics URL, that likely means you have an issue with your configuration. As a next step, verify that you're not sending additional or unnecessary headers, or duplicate values.
>
> Visit `https://[yourFullDomain]/_hcms/_worker/headers` to view all the headers that HubSpot is receiving from a request through your reverse proxy.
>
> The most important headers for proxies are:
>
> * `X-Forwarded-For`
> * `X-HubSpot-Trust-Forwarded-For`
> * `X-HS-Public-Host`

### Add the domain to HubSpot

With your proxy configured, you'll then add your domain to HubSpot. You will not be fully connecting the domain to HubSpot in the way that you would in the standard domain connection process. Rather, you'll start the connection process to make the domain available for publishing HubSpot content, but you will not create CNAME records in your DNS provider. By the end of this process, your proxy will receive all requests to the domain and can choose to proxy certain paths to HubSpot and other paths to other content hosts.

To add your domain to HubSpot:

* In your HubSpot account, navigate to your [domain settings](https://app.hubspot.com/login?loginRedirectUrl=https%3A%2F%2Fapp.hubspot.com%2Fshortlink%2Fdomains).
* Click **Connect a domain**.
* Select **Primary** or **Secondary**. Redirect and email sending domains are not supported for this feature.
* Click to toggle the **Connect with HubSpot's built-in content delivery network (CDN)** switch off, then click **Connect**.
* Select the **content type** you'll be hosting on the domain, then click **Next**.
* Enter the **brand domain**. For example, for *[www.website.com](http://www.website.com)*, you would enter **website.com**. This domain must match the domain being requested through your reverse proxy.
* Enter the **subdomain** that you'll be hosting content on. The subdomain needs to match the subdomain for the externally hosted domain. Then click **Next**.
* Review the domain you've entered, then click **Next**.
* Next, verify your domain so that HubSpot can confirm your domain ownership and allow content publishing:

  * In your DNS provider, create the records using the provided values.
  * In HubSpot, click **Verify**. It can take up to 4 hours for HubSpot to recognize changes made to your DNS provider and verify your hostname.

  <video src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/pre-provision-ssl-for-proxy.mp4" controls autoplay loop />

## Provider-specific instructions

While you can use the [general instructions above](#general-instructions) to set up your proxy, below are steps for setting up a reverse proxy with [Amazon CloudFront](#set-up-a-reverse-proxy-in-amazon-cloudfront), [nginx](#set-up-a-reverse-proxy-using-nginx), or [Cloudflare](#set-up-a-reverse-proxy-with-cloudflare-orange-to-orange) specifically.

### Set up a reverse proxy in Amazon CloudFront

To set up a reverse proxy in Amazon CloudFront, you'll need to create a new distribution with a new alternate domain name, create a new origin, then create cache behaviors for the page paths where your HubSpot content is hosted. You can learn more about working with distributions in the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-working-with.html).

* Log in to your Amazon CloudFront account.
* In the left sidebar, navigate to **Distributions**.
* If you're starting from scratch, you'll first need to create a new distribution by clicking **Create Distribution**. Alternatively, you can edit an existing distribution or skip to the [origin and behaviors setup steps](#origin).

  * On the *General* tab, click **Edit**.
  * In the **Alternate Domain Names (CNAMEs)** field, add the domain, including the subdomain. This must match the domain you added to HubSpot.
  * Confirm your changes by clicking **Yes, Edit**. You'll then be directed back to the *General* tab where your domain should now be listed next to *Alternate Domain Names (CNAMEs)*.
  * You'll also need to create a new CNAME record in your DNS provider using the value from the *Domain Name* field. This value should look something like `<value>.cloudfront.net`.

- Next, set up a new origin:

  * Click the **Origins and Origin Groups** tab.
  * Click **Create Origin**, then set up your origin:
    * In the **Origin domain** field, enter the `<HubID>.<suffix>` domain value from the [table above](#configure-the-proxy). This value should look something like `123.sites-proxy.hscoscdn20.net`.
    * Under *Add custom header*, click **Add header**. Then, add the following header details:
      * To ensure personalized content based on location works, either pass a `X-Client-IP` header with a value of the end user's IP (preferred) or pass a static header of `X-HubSpot-Trust-Forwarded-For: true`. The latter will trust the `X-Forwarded-For` header, which may not have been updated by all upstream proxies.
      * Pass a `X-HS-Public-Host` header with a value of your destination domain.
  * Click **Create** to save your changes.

- Then, set up [cache behaviors](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesCacheBehavior.html) for the page paths you'll be hosting HubSpot content on:
  * Click the **Behaviors** tab.
  * Click **Create Behavior**.
  * In the **Path pattern** field, enter the URL path of the page that your HubSpot content is hosted on. This can be a path to a specific page, or a flexible URL such as a wildcard. Learn more about [path patterns](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern).
  * Click the **Origin and Origin Groups** field, then select the origin you created earlier.
  * Click **Save changes**.

With your distribution, origin, and behaviors configured, the reverse proxy will now be available for HubSpot pages that you create at the specified paths. Proceed to the steps for [configuring your domain in HubSpot](#add-the-domain-to-hubspot).

> [!WARNING]
>
> By default, if no *Origin Request Policy* configuration is specified, Amazon CloudFront [strips cookies, query parameters and most of headers](https://community.aws/content/2wDo9asP3jcnRwl1W9g3hqNSRag/application-performance-api-dynamic-acceleration#:~:text=By%20default%2C%20If%20you%20do%20not%20explicitly%20configure) before forwarding the request to your origin. If you're seeing clicks registered as bot events, the `User-Agent` is likely being set as Amazon CloudFront instead of the visitor's. To fix this, update your [managed origin request policies](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html) to forward the visitor's `User-Agent` instead.

### Set up a reverse proxy using nginx

To configure a reverse proxy with nginx, you'll need to create a location configuration file that includes SSL information and the location path information.

> [!TIP]
>
> Full documentation for setting up reverse proxies with nginx can be found in the [nginx documentation](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/). In particular, you may want to review documentation for settings such as [securing upstream traffic](https://docs.nginx.com/nginx/admin-guide/security-controls/securing-http-traffic-upstream/), [proxy\_ssl](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_server_name), and [\$proxy\_protocol\_addr](https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/).

When working with nginx, there are several headers and settings required to route traffic. Below are snippets of a sample nginx location configuration file to use as a starting point.

```shell theme={null}
location ~ ^(/|/some-other-path) {
    proxy_set_header Host $http_host;
    proxy_set_header X-HS-Public-Host www.example.com;
    proxy_pass_request_headers on;
    proxy_set_header X-HubSpot-Trust-Forwarded-For true;
    proxy_pass https://2XX93.sites-proxy.hscoscdnXX.net;
    proxy_ssl_name www.example.com;
    proxy_ssl_server_name on;
    proxy_set_header   X-Real-IP $proxy_protocol_addr;
    proxy_set_header   X-Forwarded-Proto  $scheme;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-HubSpot-Client-IP $proxy_protocol_addr;
  }

location ~ ^(/hs|/_hcms|/hubfs|/hs-fs|/cs/c|/e3t|/events) {
    proxy_set_header Host $http_host;
    proxy_set_header X-HS-Public-Host www.example.com;
    proxy_pass_request_headers on;
    proxy_set_header X-HubSpot-Trust-Forwarded-For true;
    proxy_pass https://2XX93.sites-proxy.hscoscdnXX.net;
    proxy_ssl_name www.example.com;
    proxy_ssl_server_name on;
    proxy_set_header   X-Real-IP  $proxy_protocol_addr;
    proxy_set_header   X-Forwarded-Proto  $scheme;
    proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
    proxy_set_header   X-HubSpot-Client-IP $proxy_protocol_addr;
  }
```

In the above code, note that the proxy connection and content host domain are different: one is a HubSpot provided domain ([see configuration table](#configure-the-proxy)), and the other is the domain that the content should be served from, matching the domain you'll add to HubSpot. This is due to the SNI (Server Name Indication) connection process that establishes a secure connection between your proxy and HubSpot's servers.

To enable this in your nginx proxy, ensure that you include the settings below, which are also in the above code:

```shell theme={null}
proxy_ssl_name www.example.com;
proxy_ssl_server_name on;
```

These settings instruct nginx to send the server domain name with the SNI SSL connection handshake since the origin domain is different from the Host.

### Set up a reverse proxy with Cloudflare (Orange-to-Orange)

After you've fully reviewed the [Cloudflare-specific prerequisites](#cloudflare-prerequisites) above, and [added your domain](#add-the-domain-to-hubspot) to HubSpot, you can proceed with the steps below.

#### 1. Configure the CNAME record in Cloudflare

Configure the CNAME record in Cloudflare to point to your HubSpot zone:

1. Log in to your Cloudflare account.
2. Navigate to the zone for your domain.
3. Navigate to **DNS** > **Records**.
4. Click **Add record**.
5. Set the record type to **CNAME**.
6. In the **Name** field, enter the subdomain you added to HubSpot in the [previous step above](#add-the-domain-to-hubspot).
7. In the **Target** field, enter your HubSpot proxy domain (e.g., `123456.sites-proxy.hscoscdn00.net`).
8. Ensure the **Proxy status** is set to **Proxied** (orange cloud). This is critical, as the record must be orange-clouded for the O2O configuration to work.
9. Click **Save**.

Once the CNAME record is added with the orange cloud enabled, HubSpot will be able to verify the hostname and traffic will begin flowing to HubSpot.

> [!TIP]
>
> If zone hold is enabled on your Cloudflare account, verification will still fail at this step. Ensure zone hold is disabled before adding the CNAME record.

#### 2. Configure request header transform rules

With a traditional reverse proxy (e.g., nginx or Apache), required headers are set in your proxy configuration code. With Cloudflare, these headers must be set using **request header transform rules** (also known as "Modify Request Header" rules).

HubSpot requires the following headers to be present on all proxied requests:

| Header | Value | Purpose |
| - | - | - |
| `X-HS-Public-Host` | Your destination domain (e.g., `www.example.com`) | Tells HubSpot which domain the content should be served from |
| `X-HubSpot-Trust-Forwarded-For` | `true` | Tells HubSpot to trust the `X-Forwarded-For` header (which Cloudflare automatically adds with the visitor's IP) for location-based personalization |

To set up the header transform rules:

1. In your Cloudflare dashboard, navigate to the zone for your domain.
2. Go to **Rules → Transform Rules** (or **Rules → Overview**, then click **Modify Request Header**).
3. Click **Create rule**.
4. Give the rule a descriptive name (e.g., `HubSpot Reverse Proxy Headers`).
5. Under **When incoming requests match**, set the condition to:
   * **Field:** `Hostname`
   * **Operator:** `equals`
   * **Value:** Your domain name (e.g., `www.example.com`)
6. Under **Then**, add the following header modifications:
   * Set `X-HS-Public-Host`:
   * Action: **Set static**
   * Header name: `X-HS-Public-Host`
   * Value: Your destination domain (e.g., `www.example.com`)
   * Set `X-HubSpot-Trust-Forwarded-For`:
     * Action: **Set static**
     * Header name: `X-HubSpot-Trust-Forwarded-For`
     * Value: `true`
7. Review the rule configuration, then click **Deploy**.

> [!NOTE]
>
> You do not need to create a transform rule for `X-Forwarded-For`. Cloudflare automatically adds this header with the visitor's IP address for all proxied (orange-clouded) requests. Additionally, Cloudflare's Request Header Transform Rules do not allow modifying `X-Forwarded-For` — the backend proxy re-adds it after all rules run.

#### 3. Path-based proxying with DNS override (optional)

If you want to serve only specific paths (e.g., `/blog`) from HubSpot while keeping the rest of your domain on your existing hosting provider, you'll need to use a **Cloudflare origin rule** with a **DNS override**. This approach uses a dedicated subdomain (e.g., `hub.example.com`) that points to HubSpot, and an origin rule that routes only specific paths to that subdomain.

This is necessary because when your domain is on Cloudflare, the only way to activate the HubSpot hostname is with a proxied CNAME record. You cannot keep your main domain pointing to your existing provider and simultaneously proxy only certain paths to HubSpot without a separate subdomain.

> [!WARNING]
>
> **Please note:**
>
> * Complete Steps 1–3 using a **dedicated subdomain** (e.g., `hub.example.com`) rather than your main domain.
> * Your main domain (e.g., `www.example.com` or `example.com`) should continue pointing to your existing hosting provider with its existing DNS records.

To set up the origin rule:

1. In your Cloudflare dashboard, navigate to the zone for your domain.
2. Navigate to **Rules** > **Origin Rules**.
3. Click **Create rule**.
4. Give the rule a descriptive name (e.g., `HubSpot /blog proxy`).
5. Under **When incoming requests match**, set the condition to:
   * **Field:** `URI Path`
   * **Operator:** `starts with`
   * **Value:** `/blog` (or whatever path(s) you want to proxy to HubSpot)
6. Under **Then**, enable **DNS override** and set the destination to your HubSpot subdomain (e.g., `hub.example.com`).
7. You may also need to set a **host header override** to ensure the correct `Host` header is sent to HubSpot. Set it to your HubSpot subdomain (e.g., `hub.example.com`).
8. Review the rule configuration, then click **Deploy**.

Repeat this process for each path you want to proxy to HubSpot. You can also use a single rule with multiple path conditions if you prefer.

Once successfully configured, the following behavior will occur:

1. A visitor requests `https://www.example.com/blog`.
2. Cloudflare matches the origin rule for the `/blog` path.
3. The DNS override sends the request to `hub.example.com` (which is orange-clouded to HubSpot's zone).
4. HubSpot receives the request and serves the content.
5. For all other paths (e.g., `https://www.example.com/about`), the request goes to your existing hosting provider as normal.

#### 4. Confirm the configuration is correct

After completing the DNS and header configuration, verify that your reverse proxy is working correctly.

**Verify in HubSpot domain settings**

1. In your HubSpot account, go to **Settings → Website → Domains & URLs**.
2. Next to your domain, click the **Edit** dropdown and select **Verify Reverse Proxy Connection**.
3. Click any category labeled **Failed** to view recommendations for fixing the issue.
4. After implementing fixes, click **Refresh test** to re-check.

**Verify via the diagnostics endpoint**

Visit the following URL and confirm the diagnostic values are correct:

```
https://[your-full-domain]/_hcms/diagnostics
```

* The **current time** value changes on every load (confirms the page is not cached).
* The **User-Agent** is consistent with your browser.
* The **Accept-Language** value is consistent with your browser.
* The **Accept-Encoding** header is `*` (ensures responses are compressed).
* The **Cookie** value is not blank.
* The **Protocol** is `https`.
* The leftmost IP address in **X-Forwarded-For** matches your IP address (as reported by a service like [whatismyip.com](https://www.whatismyip.com)).
* The **IP-Determined Location** values are accurate to your location.

**Verify via the headers endpoint**

Visit the following URL to view all headers that HubSpot is receiving from your reverse proxy:

```
https://[your-full-domain]/_hcms/_worker/headers
```

Confirm that the following headers are present and correct:

* `X-Forwarded-For`
* `X-HubSpot-Trust-Forwarded-For` (should be `true`)
* `X-HS-Public-Host` (should match your domain)

If you encounter a **404 error** at the diagnostics URL, verify that you are not sending additional or unnecessary headers, or duplicate values.

#### Troubleshooting

The following sections outline common errors you may encounter during the Cloudflare reverse proxy setup process and recommended ways to fix them.

**Hostname verification fails**

| Possible cause | Solution |
| - | - |
| Zone hold is enabled in Cloudflare | Disable zone hold before adding the CNAME record |
| CNAME record is not orange-clouded | Ensure the proxy status on the CNAME record is set to **Proxied** (orange cloud) |
| CNAME points to the wrong HubSpot zone | Verify the suffix and suffix number using the tables in [Determine your HubSpot zone](#determine-your-hubspot-zone) |
| Domain still points to another server | The CNAME must point to your HubSpot proxy domain. You cannot keep your current DNS setup if it points elsewhere. |
| DNS change has not propagated | It can take up to 4 hours for HubSpot to recognize DNS changes. Wait and re-verify. |

**Headers not being received by HubSpot**

If HubSpot is not receiving the required headers:

* Verify that your transform rule is **deployed** and not in draft state.
* Confirm the **Hostname equals** condition matches your domain exactly (including subdomain).
* Check that you are not overwriting headers with another transform rule that runs later. Cloudflare applies rules in the order they are listed; rules further down the list can override earlier ones.
* Use the [headers endpoint](#verify-via-the-headers-endpoints) to inspect exactly what HubSpot is receiving.

**Pages not updating after publishing**

If pages are not updating after content is published in HubSpot:

* Ensure your Cloudflare configuration does **not** cache responses for paths originating from HubSpot. HubSpot automatically manages content caching on its CDN. If Cloudflare caches responses, pages may not update for hours or days.
* Check that no Cloudflare Page Rules or Cache Rules are set to cache everything for your domain.
