AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Set Up Custom Domain Routing and SSL Certificates on Replit

Charmaine Ng · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Routing your custom domain to a Replit project is deceptively straightforward until an edge proxy gets in the way. At 365Finds, we look at developer infrastructure through a pragmatic lens: tools should eliminate boilerplate configuration without hiding critical DNS mechanics. Replit handles automated TLS issuance and edge reverse proxying quite well, but only if you respect its specific routing constraints.

Here is exactly how custom domain routing and automated SSL certificates work on Replit, what DNS records you actually need, and the recurring configuration traps that break HTTPS provisioning.

The Deployment Prerequisite

Before touching any DNS dashboard, your project must be deployed. In older iterations of Replit, developers could point domains to interactive development workspaces. That model is deprecated.

Today, custom domain binding attaches directly to Replit Deployments (whether you choose Autoscale, Reserved VM, or Static deployment).

  1. Ensure your application is published and successfully responding on its generated subdomain (e.g., https://your-project.replit.app).
  2. Test basic application health. If your deployed container crashes on boot or throws HTTP 500 errors, Replit's edge gateway cannot properly route health checks, which complicates troubleshooting later.

Step-by-Step Custom Domain Configuration

You have two avenues: purchasing a domain directly through Replit, or pointing an external domain from registrars like Cloudflare, Namecheap, GoDaddy, or Porkbun.

At 365Finds, we firmly advise maintaining your domain registration at a dedicated external registrar rather than bundling it inside your compute platform. Decoupling DNS and compute keeps your infrastructure portable.

1. Generating DNS Records in Replit

  1. Open your project workspace in Replit.
  2. Navigate to Publishing in the left sidebar, or open Deployments settings and select the Domains tab.
  3. Click Connect your own domain.
  4. Enter your fully qualified domain name (for example, app.example.com for a dedicated subdomain, or example.com for an apex root domain).
  5. Click Next / Continue. Replit will inspect the entry and output two distinct DNS records:
    • An A Record: Pointing to Replit’s ingress load balancer IP address.
    • A TXT Record: A verification key (e.g., replit-verify=<token>) used to prove domain control and authorize automated certificate provisioning.

2. Entering DNS Records at Your Registrar

Head over to your registrar’s DNS management console and insert the exact values provided by Replit.

Record TypeHost / NameTarget / ValuePurpose
A@ (or subdomain like app)Replit Gateway IP provided in dashboardRoutes incoming IPv4 traffic to Replit proxy
TXT@ (or subdomain like app)Verification hash from ReplitAuthorizes domain ownership and Let's Encrypt validation

Two critical rules on DNS record types:

3. Verification and SSL/TLS Certificate Provisioning

Once DNS records are published:

  1. Return to the Replit Domains interface and click Verify.
  2. Replit queries public DNS resolvers to confirm that the A and TXT records resolve correctly.
  3. When DNS propagation completes, Replit’s edge proxy triggers automated certificate generation (typically backed by Let's Encrypt or Google Trust Services).
  4. Replit terminates TLS at its edge ingress, enforces HTTPS redirection across all HTTP requests, and injects HTTP Strict Transport Security (HSTS) headers.

In clean network conditions, the entire handshake resolves in two to ten minutes. In worst-case propagation delays, it can take several hours.

Three Traps That Break Replit SSL

Almost every failed Replit custom domain setup we investigate at 365Finds boils down to one of these three mistakes:

1. The Cloudflare "Orange Cloud" Proxy Conflict

If you manage DNS through Cloudflare, Cloudflare's default setting is to proxy traffic through its own CDN edge (indicated by the Orange Cloud icon).

This breaks Replit's automated verification. Replit’s ACME challenge needs to speak directly to the origin verification endpoint. If Cloudflare intercepts the HTTP-01 challenge or returns its own edge certificate before Replit validates the domain, Replit hangs indefinitely on "Validating" or fails certificate issuance.

The Fix: Set the proxy status in Cloudflare to DNS Only (the Grey Cloud) for both the A and TXT records during setup. Leave it unproxied unless you explicitly configure Cloudflare origin certificates and full SSL modes.

2. Deleting the TXT Verification Record

After the domain status turns green and HTTPS works, some engineers tidy up their DNS zone files and delete the replit-verify TXT record.

Do not touch it. Modern managed SSL certificates expire every 60 to 90 days. Replit’s background daemon requires the TXT record to automatically re-verify ownership and renew the certificate without dropping traffic. If the record is missing, renewal fails silently until your site starts throwing untrusted certificate warnings.

3. Idle Deployments and Cold Boot 502s

When using Replit's Autoscale deployments, containers spin down to zero instances during inactivity to conserve deployment compute units.

When a user visits your custom domain after an idle period, Replit's edge proxy initiates a cold boot. If your application takes longer than 10–15 seconds to spin up, users may see an initial 502 or 504 gateway timeout. That is not an SSL certificate failure or a routing misconfiguration—it is the operational reality of scale-to-zero compute. If continuous sub-second uptime is mandatory for your brand domain, 365Finds recommends switching your Replit Deployment configuration from Autoscale to a Reserved VM.

Replit's ingress proxy routes production traffic reliably once DNS and verification records are locked in place. The key is leaving the TXT record permanently attached and keeping external proxy layers out of the verification path.

References