Skip to main content
This guide walks through the process of setting up a reverse proxy with HubSpot. This process includes the following steps: The guide includes general instructions as well as provider-specific instructions for nginx, Amazon CloudFront, and Cloudflare’s 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 to:
Please note: reverse proxy setup is not supported by HubSpot’s support team. For implementation help, check out HubSpot’s Community forums or the Solutions Directory to find a HubSpot partner.

Cloudflare prerequisites

A Cloudflare Enterprise account is required to set up an Orange-to-Orange (O2O) 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.
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 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 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 or Cloudflare, or an nginx server.
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. 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 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. 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, Amazon CloudFront, or Cloudflare. 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/*
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.

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.
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.
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.
  • The IP-Determined Location values are accurate to your location. These are based on the IP-related headers in X-Forwarded-For.
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.
  • 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, 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.

Provider-specific instructions

While you can use the general instructions above to set up your proxy, below are steps for setting up a reverse proxy with Amazon CloudFront, nginx, or Cloudflare 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.
  • 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.
    • 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. 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 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.
    • 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.
By default, if no Origin Request Policy configuration is specified, Amazon CloudFront strips cookies, query parameters and most of headers 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 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.
Full documentation for setting up reverse proxies with nginx can be found in the nginx documentation. In particular, you may want to review documentation for settings such as securing upstream traffic, proxy_ssl, and $proxy_protocol_addr.
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.
In the above code, note that the proxy connection and content host domain are different: one is a HubSpot provided domain (see configuration table), 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:
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 above, and added your domain 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.
  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.
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: 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.
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.
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:
  • 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).
  • 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:
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 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 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.
Last modified on October 9, 2026