While websites built on HubSpot automatically use a global CDN, HubSpot also supports reverse proxies. If you have an existing CDN or complex routing rules that aren’t possible to maintain using HubSpot’s CDN, learn how to set up a reverse proxy for your HubSpot-hosted content.
www.website.com
which is not hosted on the HubSpot CMS, while also hosting a blog on HubSpot at www.website.com/blog
. Using a reverse proxy, the blog would appear to be hosted from the same server as the website when it’s actually coming from HubSpot’s servers.
Below, learn more about how to set up a reverse proxy with HubSpot. By the end of the guide, you will have:
404
error during that process.429
or 403
responses until an in-browser JavaScript challenge is completed.sitemap.xml
file won’t include HubSpot pages unless you manually add them.
Before proceeding with a reverse proxy setup, review the list of feature considerations below.
Feature | HubSpot’s CDN | Custom solution |
---|---|---|
Bandwith | Included | Additional cost |
SSL | Included; automatic setup | Additional cost; manual setup |
Global CDN | Included | ? |
Automatic cache management | Included | No |
Anti-abuse protection | Included | Customer-owned |
24x7 monitoring | Included | Customer-owned |
Support | Included | Customer-owned |
IPv6 | Included | ? |
HTTP/2 | Included | ? |
Latency | Optimal | Additional network hop required |
Configure the proxy
<HubID>.<suffix>
. The suffix value is determined by your account’s assigned data center and the last two digits of your HubID.Use the tables below to find the correct suffix along with the correct numbers to include in the suffix.Suffixes by data centerData 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 |
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 |
123456
and is hosted in the US East data center, the correct origin CNAME would be 123456.sites-proxy.hscoscdn00.net
.Once you’ve noted the correct CNAME to use, continue reading for general instructions for configuring a reverse proxy, as well as specific guidance for Amazon CloudFront and nginx.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.X-HubSpot-Trust-Forwarded-For: true
. This will trust the X-Forwarded-For
header, which may not have been updated by all upstream proxies.X-HS-Public-Host
header with a value of your destination domain./_hcms/*
, /hs/*
, /hubfs/*
, hs-fs/hubfs/*
, /hs-fs/*
, /cs/c/*
, and /e3t/*
.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 your configuration is correct
https://[yourFullDomain]/_hcms/diagnostics
User-Agent
is consistent with your browser.Accept-Language
value is consistent with your browser.Accept-Encoding
header is *
. This ensures that responses are compressed.Cookie
value is not blank.Protocol
is https
.X-Forwarded-For
matches your IP address as reported by a service like https://www.whatismyip.com.IP-Determined Location
values are accurate to your location. These are based on the IP-related headers in X-Forwarded-For
.404
when going to the diagnostics URL, that likely means you have an issue with your configuration.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
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.Add the domain to HubSpot
<value>.cloudfront.net
.<HubID>.<suffix>
CNAME value from the table above. This value should look something like 123.sites-proxy.hscoscdn20.net
.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.X-HS-Public-Host
header with a value of your destination domain.Amazon CloudFront
, which will result in clicks to be marked as bot events. To resolve this, you should update origin request policies to forward the visitor’s User-Agent instead.