/ai/* while the rest of the site remains unchanged.
Services Used
Architecture
Path-Based Routing (No UA Cloaking)
We use path-based routing, NOT User-Agent based cloaking. This is safer and more transparent:Why Path-Based?
- No cloaking risk: Same content for bots and humans on same URLs
- Transparent: Humans can access
/ai/*pages too (they just wonβt find them) - SEO safe: Clear separation between Shopify pages and AI pages
- Canonical tags:
/ai/*pages point canonical to Shopify URLs
Control File Takeover
We override these Shopify files at the edge:Unified Sitemap Strategy
Our/sitemap.xml contains all URLs in a single file:
- Shopify URLs - Fetched during onboarding and stored in
ai_sites.shopify_sitemap_urls - AI pages -
/ai/products/*,/ai/collections/*,/ai/<faq-slug> - AI files -
/llms.txt,/llms/*.txt
- No confusion from multiple sitemaps
- Shopify indexing is preserved
- AI pages are discoverable
Connection Flow
The domain connection is a two-part process designed for zero downtime:Part 1: SSL Certificate + Google TXT
- User clicks βStart Secure Connectionβ
- We request a Letβs Encrypt certificate via DNS-01 challenge
- We also request a Google verification token
- User adds BOTH TXT records via Entri (one-click DNS):
- SSL validation TXT record
- Google verification TXT record
- Letβs Encrypt validates and issues certificate
- Certificate is imported to ACM and attached to CloudFront
Part 2: Connect Domain + Verify Google
- SSL is ready on CloudFront
- User clicks βPoint Domainβ
- User configures DNS via Entri (one-click):
- CNAME
wwwβ CloudFront distribution - A
@β Our gateway IPs (for naked domain)
- CNAME
- Traffic now flows through our proxy (both
wwwand naked domain) - Background tasks trigger:
- ACM-native certificate upgrade (auto-renewal)
- Google verification polling (10s Γ 12 = 2 min)
- Once Google verified β IndexNow + GSC sitemap submission
- If Google fails β IndexNow only (GSC skipped)
Both www and naked domain are configured together. Whether the user enters
www.example.com or example.com as their business URL, Part 2 sets up DNS records for both to ensure the full domain works.Status Flow
Endpoints
Setup CloudFront Proxy is now part of the Onboarding flow - it runs automatically during
generate-all.Why Letβs Encrypt + ACM?
We use a hybrid approach for SSL certificates: Initial: Letβs Encrypt- Works with ANY DNS provider
- Bypasses CAA restrictions (Vercel/Netlify block ACM)
- User adds one TXT record, done
- Once www points to CloudFront, ACM can validate
- Background upgrade happens automatically
- ACM-native certs auto-renew forever
- User never has to touch DNS again
Lambda@Edge Path-Based Routing
The Lambda@Edge function atorigin-request routes based on URL path:
Updating Routing Rules
When routing rules need to change:Database Schema
Theai_sites table stores all proxy configuration:
Disconnect and Relink Flow
Users can disconnect their domain and reconnect later:Disconnect Flow
- User clicks βDisconnect Domainβ
- Frontend calls
/disconnect-proxyβ gets restore DNS records - Entri restores www CNAME to original
- Frontend calls
/mark-disconnect-completeβ status becomes DISCONNECTED - CloudFront + ACM stay intact (for fast relink)
Relink Flow (Fast)
- User clicks βReconnectβ
- No CloudFront setup needed - distribution already exists
- Start certificate (if expired) or skip
- 2-step DNS flow: SSL CNAME β www CNAME
- Status becomes DEPLOYED