How to use nginx as a reverse proxy for the HubSpot site

I have a hubspot site named www.abc.com, I currently have an nginx server, and I want to use abc.com.cn to proxy abc.com/zh/*. How can I do this. I refer to this link“ https://developers.hubspot.com/docs/guides/cms/content/performance/reverse-proxy-support ”However, after configuring it, accessing ‘abc.com.cn’ always returns 404.

Hi @CNB9,
Thank you for posting to the Community!
Tagging in some of our Top Contributors to see if they have any ideas -- @Humashankar @SanjayKumar Have either of you all seen this behavior before?
Cassie, Community Manager

Hi @chighsmith thank you.

Hi @CNB9

It looks like the 404 happens because HubSpot doesn’t recognize tranter.com.cn as a valid host.
In your Nginx config, make sure you set

proxy_set_header Host www.tranter.com;
proxy_redirect Responsive Heat Exchangers | Tailored Solutions for Your Business | Tranter /;

so requests are passed with the correct host and redirects point back to your .cn domain.
Just note HubSpot isn’t designed to run behind a reverse proxy, so some links or scripts may still point back to www.tranter.com.

To learn more - Use a reverse proxy with HubSpot | HubSpot

Regards

Hi @Humashankar , thank you. I set it in nginx config, but it still 404. I don’t know what went wrong。

Hi @CNB9

Since all reverse proxy checks for tranter.com.cn have passed but you’re still seeing a 404, it usually means HubSpot recognizes the proxy setup and headers, but the target content or root path might not match what’s published in HubSpot.

  • Kindy double-check that the HubSpot page at /zh/ is live and published, that the content slug hasn’t changed, and ensure the Nginx location block proxying / correctly passes requests to /zh/ as you intend.

Sometimes, HubSpot can return a 404 for missing or unpublished content even when the proxy setup is correct.

Regards

Hi @Humashankar
What I want is this, for example: when I visit“ 垫片式板式换热器 | Tranter ”, it actually needs to display the information on Hubspot“ Responsive Heat Exchangers | Tailored Solutions for Your Business | Tranter ”The content of this article. Can reverse proxy be used to achieve this situation? It seems that connecting ‘tranter. com. cn’ to Hubspot cannot solve this problem

Hi @CNB9

Yes, this setup is possible with a reverse proxy and path rewrites, but it won’t be perfect, especially for SEO and internal navigation, because of how HubSpot manages domains and links.

In practice, reverse proxy setups work for specific use cases like serving apps alongside HubSpot content but are advised to weigh the trade-offs carefully.

HubSpot’s recommended best practice remains to connect custom domains directly in HubSpot when possible to ensure full functionality and SEO benefits.

Take a look at this resource:

Regards

Hi @CNB9

The 404 usually means HubSpot isn’t recognizing the proxied path. In your nginx config, make sure you’re forwarding not just the domain but also the /zh/ path.

For example:

location / {
 proxy_pass https://www.abc.com/zh/;
 proxy_set_header Host www.abc.com;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto $scheme;
}

HubSpot’s reverse proxy support requires the Host header to match the HubSpot domain, docs:

(Accounts Dashboard | HubSpot )

If the header stays as abc.com.cn, HubSpot returns 404. Setting proxy_set_header Host www.abc.com; should fix it.

Also confirm that the subdomain mapping is set up inside HubSpot. If HubSpot doesn’t know about abc.com.cn, it won’t respond correctly.

Sometimes teams go for a sync layer like Stacksync when juggling multiple domains or regions so content updates flow in real time everywhere and you don’t depend only on proxy rewrites to keep things consistent.

Hope this helps.

Hi @RubenBurdin , Thanks for your reply, This is my configuration, Visit https://tranter.com.cn, or get 404. the Responsive Heat Exchangers | Tailored Solutions for Your Business | Tranter is working.

154129i1FA294AE4A0F55F8.png

I want to use reverse proxy to display the content of Responsive Heat Exchangers | Tailored Solutions for Your Business | Tranter when I visit https://tranter.com.cn/ . The `https://www.tranter.com/zh/` is a hubspot website, the `https://tranter.com.cn/ ` is a nginx server. I now visit `https://tranter.com.cn/\` and always get 404,am I missing some configuration?