Prerequisites
This process requires configuration via Terraform to set up the Auth0 components and deployment of a Cloudflare Worker for the proxy logic. Before getting started with your migration, review the requirements below:- A tenant on an Enterprise plan with MCD enabled.
- Two verified custom domains configured in your Auth0 tenant:
- Old legacy domain (for the proxy)
- New target domain (for the application)
- Terraform CLI and
Node.js/npminstalled. - Cloudflare account with access to the domain hosting your custom domains.
How it works
This migration strategy uses a smart reverse proxy to bridge the gap between your legacy custom domain and your new domain. This proxy is deployed on the old domain to intercept the SAML authentication response sent by your external Identity Provider (IdP). This is necessary because the IdP’s configuration is hardcoded to your old domain’s endpoint. The proxy modifies the SAML payload’s control fields (likeDestination and Recipient) to accurately reflect the new custom domain.
Finally, the proxy forwards this corrected payload to the new domain’s login endpoint. This enables a zero-downtime cutover to your new domain without requiring manual configuration changes from your IdP partners.
Setup and configuration
To setup and configure your migration:- Clone the migration repository:
- Install dependencies:
- Create a
terraform.auto.tfvarsfile in yourtffirectory with the required credentials and domain information:
- Initialize and apply Terraform:
Deploy the Cloudflare worker
This proxy handles the SAML response interception and redirection logic. To deploy:- Deploy the Cloudflare proxy:
- The worker automatically receives the required environment variables (like
AUTH0_EDGE_LOCATIONandNEW_SP_DOMAIN) from the Terraform output.
Temporarily update SAML connection parameters
Your old domain receives the SAML response before being reposted to the new domain. Therefore, the SAML Connection’s expected validation parameters must temporarily point to the old domain’s callback URL to avoid mismatch errors.-
Obtain a Management API access token for your service provider tenant, with
read:connectionsandupdate:connectionsscopes: -
Update destination URL:
-
Update recipient URL: