To connect a custom domain to a Replit app, first deploy your project using Autoscale, Reserved VM, or Static deployment (custom domains are not available for Scheduled deployments). Then go to the Deployments tab, open Settings, click Link a domain, enter your domain, and copy the A records and TXT records Replit provides. Add these DNS records at your domain registrar and wait for propagation. Replit automatically provisions TLS/SSL certificates.
Connect a Custom Domain to Your Replit-Hosted Web App
This tutorial walks you through linking your own domain name to a Replit deployment. By default, Replit gives you a free .replit.app subdomain, but for professional projects you will want a custom domain like yourbrand.com. This guide covers DNS configuration including A records and TXT verification records, SSL certificate handling, and common pitfalls with Cloudflare and other registrars. It is aimed at intermediate users who have already deployed a Replit project and want to give it a professional URL.
Prerequisites
- A deployed Replit app (Autoscale, Reserved VM, or Static deployment)
- A registered domain name with access to DNS management
- A Replit Core, Pro, or Enterprise plan
- Basic understanding of what DNS records are
Step-by-step guide
Deploy your app if you have not already
Deploy your app if you have not already
Custom domains require an active deployment. Click the Publish button in the top-right corner of your workspace and choose a deployment type: Autoscale (scales with traffic, ideal for web apps), Reserved VM (always-on, ideal for WebSocket apps), or Static (free hosting for HTML/CSS/JS only). Scheduled deployments do not support custom domains. Wait for the deployment to complete and verify your app is accessible at the default .replit.app URL before proceeding.
Expected result: Your app is live and accessible at its default .replit.app subdomain.
Open the domain linking interface in Replit
Open the domain linking interface in Replit
Navigate to the Deployments tab in your workspace. Click Settings within the deployment panel. You will see a section for custom domains. Click Link a domain and enter the domain you want to connect, such as myapp.com or app.mycompany.com. Replit generates the DNS records you need to add at your registrar. Copy these records carefully as you will need both the A records (which point to Replit's servers) and a TXT record (which verifies domain ownership).
Expected result: Replit displays A record IP addresses and a TXT verification record for you to copy.
Add DNS records at your domain registrar
Add DNS records at your domain registrar
Log into your domain registrar (GoDaddy, Namecheap, Cloudflare, Google Domains, or any other provider). Navigate to DNS management for your domain. Add the A records Replit provided, pointing your domain to Replit's IP addresses. Then add the TXT record for ownership verification. If your registrar already has existing A records or AAAA records pointing elsewhere, remove them first. Having multiple A records pointing to different servers or AAAA records coexisting with A records causes connection failures.
Expected result: Your registrar shows the new A records and TXT record in the DNS management panel.
Handle Cloudflare-specific configuration
Handle Cloudflare-specific configuration
If you use Cloudflare as your DNS provider, there is a critical setting you must change. By default, Cloudflare proxies traffic through its network (indicated by an orange cloud icon next to DNS records). This proxy mode prevents Replit from automatically issuing and renewing SSL certificates for your domain. Switch each DNS record to DNS-only mode by clicking the orange cloud icon until it turns gray. This allows Replit to handle SSL directly. If you later see SSL certificate errors, this is almost always the cause.
Expected result: Cloudflare DNS records show gray cloud icons (DNS-only mode) instead of orange (proxied mode).
Wait for DNS propagation and verify the connection
Wait for DNS propagation and verify the connection
DNS changes can take anywhere from a few minutes to 48 hours to propagate globally, though most registrars complete propagation within 1-2 hours. Return to the Replit Deployments Settings panel to check the domain status. It will show Verifying while DNS propagation is in progress, then switch to Connected once Replit confirms the records. Replit automatically provisions a TLS/SSL certificate once verification completes. If the domain stays on Verifying for more than 48 hours, double-check your DNS records for typos or conflicting entries.
Expected result: The domain status in Replit changes to Connected and your site is accessible at your custom domain with HTTPS.
Troubleshoot SSL certificate errors
Troubleshoot SSL certificate errors
If visitors see a NET::ERR_CERT_COMMON_NAME_INVALID error, the SSL certificate has not been properly issued for your domain. Common causes include Cloudflare proxy mode being enabled, AAAA records conflicting with A records, or the domain verification not completing. To fix this, first ensure DNS-only mode is active if using Cloudflare. Then try unlinking the domain in Replit and relinking it to trigger a fresh certificate issuance. For complex domain configurations involving multiple subdomains or enterprise setups, RapidDev can provide specialized guidance on DNS and deployment architecture.
Expected result: Your custom domain loads with a valid SSL certificate and no browser warnings.
Complete working example
1# .replit configuration for a deployed web app with custom domain23entrypoint = "index.js"4run = ["node", "index.js"]56[nix]7channel = "stable-24_05"8packages = ["nodejs-20_x"]910# Port configuration - externalPort must be 8011[[ports]]12localPort = 300013externalPort = 801415[deployment]16run = ["node", "index.js"]17build = ["npm", "run", "build"]18deploymentTarget = "cloudrun"1920# Server must bind to 0.0.0.0 for deployments to work21# Example server code:22# app.listen(3000, '0.0.0.0', () => {23# console.log('Server running on port 3000');24# });2526# Custom domain checklist:27# 1. Deploy app (Autoscale/Reserved VM/Static)28# 2. Deployments tab > Settings > Link a domain29# 3. Copy A records + TXT record to registrar30# 4. If Cloudflare: disable proxy (DNS-only mode)31# 5. Wait for verification + SSL certificateCommon mistakes when connecting a custom domain to Replit
Why it's a problem: Leaving Cloudflare proxy mode enabled (orange cloud icon)
How to avoid: Click the cloud icon next to each DNS record in Cloudflare until it turns gray (DNS-only). Proxied mode prevents Replit from issuing SSL certificates.
Why it's a problem: Keeping old AAAA records alongside the new A records
How to avoid: Delete all AAAA records for the domain. Replit only supports A records, and conflicting IPv6 records cause intermittent connection failures.
Why it's a problem: Trying to use a custom domain with a Scheduled deployment
How to avoid: Custom domains are only supported on Autoscale, Reserved VM, and Static deployments. Switch to one of these deployment types.
Why it's a problem: Adding multiple A records pointing to different servers
How to avoid: Remove all existing A records for the domain before adding the Replit-provided records. Multiple A records pointing to different servers cause unpredictable routing.
Best practices
- Always remove conflicting A records and AAAA records before adding Replit DNS records
- Use DNS-only mode (not proxied) when using Cloudflare as your DNS provider
- Verify your app works at the default .replit.app URL before attempting custom domain setup
- Check both root domain (example.com) and www subdomain configuration if you want both to work
- Keep a record of the DNS records Replit provides in case you need to reconfigure later
- Test the domain from multiple geographic locations using dnschecker.org after setup
- Set up a redirect from www to non-www (or vice versa) for consistent URL behavior
- Monitor SSL certificate expiration and unlink/relink the domain if auto-renewal fails
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I have a Replit app deployed at [app-name].replit.app and I want to connect my custom domain [domain.com] to it. I use [Cloudflare/GoDaddy/Namecheap] for DNS. Walk me through the exact DNS records I need to add and any provider-specific settings I should change.
My app is deployed on Replit but I need to connect my custom domain [domain.com]. Help me verify that my .replit configuration has the correct port mapping (externalPort 80) and that my server binds to 0.0.0.0. Then walk me through the deployment settings for linking the domain.
Frequently asked questions
DNS propagation typically takes a few minutes to 2 hours, but can take up to 48 hours in rare cases. You can check propagation status using dnschecker.org to see if your A records are resolving correctly across different regions.
Yes. Replit automatically provisions TLS/SSL certificates for both the default .replit.app subdomain and any custom domains you link. Certificates are managed and renewed automatically as long as DNS records are correctly configured.
No. Custom domains require a paid Replit plan (Core, Pro, or Enterprise) with an active Autoscale, Reserved VM, or Static deployment.
This usually means DNS records have not propagated yet or are incorrect. Verify that your A records and TXT record match exactly what Replit provided. Remove any conflicting AAAA records. If using Cloudflare, ensure proxy mode is disabled (DNS-only).
Yes. Replit offers direct domain purchasing with automatic DNS configuration, WHOIS privacy, and custom DNS records. This eliminates the manual DNS setup process entirely.
Replit handles SSL certificate renewal automatically. If renewal fails (often due to Cloudflare proxy mode being enabled), unlink the domain in Deployments Settings and relink it to trigger a fresh certificate issuance.
Yes. RapidDev assists with multi-domain setups, enterprise DNS configurations, and deployment architecture. They can help when your custom domain setup involves subdomains, redirects, or integration with CDNs beyond the standard Replit workflow.
Yes. You can link multiple domains or subdomains to a single deployment. Each domain requires its own set of DNS records. Add them one at a time through the Deployments Settings panel.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation