Step 1: Set Up Your Custom Domain in Your Registrar
- Go to your domain registrar where you've purchased your custom domain.
- Log in to your account and navigate to the DNS management or Zone File settings for your domain.
- Create a new A record:
- Type: A
- Name: Use "@" to map to the root of the domain, or specify a subdomain if you prefer (e.g., "api" for api.yourdomain.com).
- Value: Point this at the IP address of your Supabase instance (This information is typically provided by Supabase in your project's settings).
- TTL: Default or automatic is usually fine.
Step 2: Configure Your Supabase Project's Domain Settings
- Go to your Supabase dashboard and log into your account.
- Select the project you want to configure with your custom domain.
- Navigate to the Settings tab on the sidebar.
- Under Settings, find the Custom Domain section.
- Enter your custom domain or subdomain that you used in Step 1 (e.g.,
example.com
or api.example.com
).
Step 3: Verify the DNS Setting
- Supabase will provide a unique DNS verification record that you need to add to your domain settings.
- Return to your domain registrar's DNS management settings.
- Create a new CNAME record:
- Type: CNAME
- Name: Typically this will be something like
_supabase-challenge.<yourdomain>
provided by Supabase.
- Value: Point this at the verification target provided by Supabase (e.g.,
something.supabase.co
).
- TTL: Default or automatic is usually fine.
- Save the changes and return to Supabase's dashboard.
Step 4: Confirm Verification on Supabase
- Once the DNS changes propagate, return to the Supabase dashboard.
- In the Custom Domain settings, click the button to verify the DNS record.
- Supabase will check for the verification record.
- If correctly set, Supabase will confirm the domain properly points to your project.
Step 5: Secure the Connection with SSL
- After verifying your domain, ensure your connection is secure with SSL:
- Supabase automatically provisions an SSL certificate through Let's Encrypt.
- No additional configuration is typically needed from your side.
- Check that your domain is now using HTTPS by visiting it in a browser.
Step 6: Update Environment & API Calls
- Update your application’s environment variables or configuration files to use the custom domain.
- Replace any existing Supabase URLs with your custom domain for API calls.
const SUPABASE\_URL = "https://api.example.com";
const SUPABASE\_KEY = "your-anon-key";
- Ensure the Supabase client or any other part of your application points to your custom domain.
Step 7: Test the Connection
- Deploy your application updates or restart your local server to make sure everything is on the custom domain.
- Perform a few API requests to ensure that your application communicates correctly with Supabase on your custom domain.
- Verify that data transactions, user authentication, and other Supabase services function as expected.
Step 8: Monitor & Maintain
- Monitor your domain to ensure the service stays connected and operates smoothly.
- Occasionally verify that your SSL certificate is refreshed automatically.
- Update Supabase records promptly if you ever change hosts or DNS settings.