Tutorial: Setting up a Reverse Proxy With HubSpot CMS (with sample nginx & Cloudfront configs !)

@PTrojanowski In this situation, I’ll assume the following:

  1. You have an externally (non-HubSpot) hosted website at ‘mydomain.com
  2. You have an existing blog hosted with HubSpot at blog.mydomain.com
  3. You want to have traffic go to mydomain.com/blog/{article} and that content to be your HubSpot hosted blog origin

Assuming that’s the desired behavior, you would need to (at a high level):

  1. Have the HubSpot CMS Enterprise product tier
  2. Follow the instructions to ‘add’ mydomain.com to HubSpot, but not ACTUALLY update your DNS to point the domain at HubSpot (it should point to your proxy server)
  3. Once SSL is pre-provisioned in HubSpot, make mydomain.com/blog the new primary domain & sub-directory of your HubSpot hosted blog in HubSpot
  4. Have your proxy point traffic at HubSpot for the specific routes
  5. Set up redirects for all traffic from blog.mydomain.com/{article} to mydomain.com/blog/{article} so that old traffic routes to the proxied domain