Custom Domain Setup
Setting up a custom domain for your Dockit documentation site helps establish your brand identity and provides a professional appearance. This guide covers the complete process of configuring custom domains across different hosting platforms.
Overview
Заголовок раздела «Overview»A custom domain allows you to serve your documentation from your own branded URL instead of the default hosting provider subdomain. For example:
- Default:
your-docs.netlify.apporyour-docs.vercel.app - Custom:
docs.yourcompany.comorhelp.yourcompany.com
Prerequisites
Заголовок раздела «Prerequisites»Before setting up a custom domain, ensure you have:
- Domain ownership: You own or control the domain you want to use
- DNS access: Ability to modify DNS records for your domain
- Deployed site: Your Dockit site is already deployed and working
- SSL certificate: HTTPS support (usually provided automatically)
Domain Configuration Options
Заголовок раздела «Domain Configuration Options»Subdomain Setup (Recommended)
Заголовок раздела «Subdomain Setup (Recommended)»Using a subdomain is the most common and recommended approach:
docs.yourcompany.comhelp.yourcompany.comsupport.yourcompany.comknowledge.yourcompany.comRoot Domain Setup
Заголовок раздела «Root Domain Setup»You can also use your root domain, though this requires additional considerations:
yourcompany.comyourdocs.comPath-based Setup
Заголовок раздела «Path-based Setup»Serve documentation from a specific path:
yourcompany.com/docsyourcompany.com/helpPlatform-Specific Setup
Заголовок раздела «Platform-Specific Setup»Netlify Configuration
Заголовок раздела «Netlify Configuration»Step 1: Add Custom Domain in Netlify
Заголовок раздела «Step 1: Add Custom Domain in Netlify»- Go to your site’s Site Settings in Netlify dashboard
- Navigate to Domain management → Custom domains
- Click Add custom domain
- Enter your domain (e.g.,
docs.yourcompany.com)
Step 2: Configure DNS Records
Заголовок раздела «Step 2: Configure DNS Records»Add a CNAME record in your DNS provider:
Type: CNAMEName: docs (or your chosen subdomain)Value: your-site-name.netlify.appTTL: 3600 (or Auto)Step 3: Enable HTTPS
Заголовок раздела «Step 3: Enable HTTPS»Netlify automatically provisions SSL certificates through Let’s Encrypt:
- Wait for DNS propagation (up to 24 hours)
- SSL certificate will be automatically issued
- Force HTTPS redirect in Site Settings → HTTPS
Step 4: Configure _redirects (Optional)
Заголовок раздела «Step 4: Configure _redirects (Optional)»Create a _redirects file in your public/ directory:
# Force HTTPShttp://docs.yourcompany.com/* https://docs.yourcompany.com/:splat 301!
# Redirect old paths/old-docs/* /new-docs/:splat 301/v1/* /latest/:splat 301
# SPA fallback/* /index.html 200Vercel Configuration
Заголовок раздела «Vercel Configuration»Step 1: Add Domain in Vercel
Заголовок раздела «Step 1: Add Domain in Vercel»- Go to your project dashboard
- Navigate to Settings → Domains
- Enter your custom domain
- Choose the deployment branch
Step 2: Configure DNS
Заголовок раздела «Step 2: Configure DNS»For subdomains, add a CNAME record:
Type: CNAMEName: docsValue: cname.vercel-dns.comFor root domains, add A records:
Type: AName: @Value: 76.76.19.61
Type: AName: @Value: 76.76.19.62Step 3: Verify Domain
Заголовок раздела «Step 3: Verify Domain»Vercel will automatically verify your domain and issue SSL certificates.
Step 4: Configure vercel.json
Заголовок раздела «Step 4: Configure vercel.json»{ "redirects": [ { "source": "/old-path", "destination": "/new-path", "permanent": true } ], "headers": [ { "source": "/(.*)", "headers": [ { "key": "X-Content-Type-Options", "value": "nosniff" }, { "key": "X-Frame-Options", "value": "DENY" }, { "key": "X-XSS-Protection", "value": "1; mode=block" } ] } ]}GitHub Pages Configuration
Заголовок раздела «GitHub Pages Configuration»Step 1: Configure Repository Settings
Заголовок раздела «Step 1: Configure Repository Settings»- Go to repository Settings → Pages
- Select source (usually
mainbranch) - Add custom domain in the Custom domain field
Step 2: Create CNAME File
Заголовок раздела «Step 2: Create CNAME File»Create a CNAME file in your repository root or public/ directory:
docs.yourcompany.comStep 3: Configure DNS
Заголовок раздела «Step 3: Configure DNS»Add a CNAME record pointing to GitHub Pages:
Type: CNAMEName: docsValue: yourusername.github.ioStep 4: Enable HTTPS
Заголовок раздела «Step 4: Enable HTTPS»GitHub Pages automatically provides SSL certificates for custom domains.
Firebase Hosting Configuration
Заголовок раздела «Firebase Hosting Configuration»Step 1: Configure firebase.json
Заголовок раздела «Step 1: Configure firebase.json»{ "hosting": { "public": "dist", "site": "your-project-id", "cleanUrls": true, "trailingSlash": false, "rewrites": [ { "source": "**", "destination": "/index.html" } ], "headers": [ { "source": "**/*.@(jpg|jpeg|gif|png|svg|webp|js|css)", "headers": [ { "key": "Cache-Control", "value": "max-age=31536000" } ] } ] }}Step 2: Add Custom Domain
Заголовок раздела «Step 2: Add Custom Domain»firebase hosting:channel:deploy live --only hostingfirebase hosting:site:get your-project-idAdd domain in Firebase Console:
- Go to Hosting section
- Click Add custom domain
- Follow the verification steps
Step 3: DNS Configuration
Заголовок раздела «Step 3: DNS Configuration»Add the provided DNS records from Firebase Console.
DNS Provider Examples
Заголовок раздела «DNS Provider Examples»Cloudflare DNS
Заголовок раздела «Cloudflare DNS»Type: CNAMEName: docsContent: your-site.netlify.appProxy status: Proxied (orange cloud)TTL: AutoAdditional Cloudflare settings:
- SSL/TLS: Full (strict)
- Always Use HTTPS: On
- Automatic HTTPS Rewrites: On
Google Domains
Заголовок раздела «Google Domains»Type: CNAMEName: docsData: your-site.netlify.app.TTL: 1 hourNamecheap DNS
Заголовок раздела «Namecheap DNS»Type: CNAME RecordHost: docsValue: your-site.netlify.appTTL: AutomaticRoute 53 (AWS)
Заголовок раздела «Route 53 (AWS)»{ "Type": "CNAME", "Name": "docs.yourcompany.com", "Value": "your-site.netlify.app", "TTL": 300}SSL Certificate Configuration
Заголовок раздела «SSL Certificate Configuration»Automatic SSL (Recommended)
Заголовок раздела «Automatic SSL (Recommended)»Most modern hosting platforms provide automatic SSL:
- Netlify: Let’s Encrypt (automatic)
- Vercel: Automatic SSL provisioning
- GitHub Pages: Automatic for custom domains
- Firebase: Google-managed certificates
Manual SSL Configuration
Заголовок раздела «Manual SSL Configuration»For advanced setups, you might need manual SSL configuration:
server { listen 443 ssl http2; server_name docs.yourcompany.com;
ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/private.key;
ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512; ssl_prefer_server_ciphers off;
location / { proxy_pass http://localhost:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }}Advanced Configuration
Заголовок раздела «Advanced Configuration»Multiple Domains
Заголовок раздела «Multiple Domains»Configure multiple domains for the same site:
[[redirects]] from = "https://old-docs.com/*" to = "https://docs.yourcompany.com/:splat" status = 301 force = true
[[redirects]] from = "https://help.yourcompany.com/*" to = "https://docs.yourcompany.com/:splat" status = 301 force = trueInternationalization Domains
Заголовок раздела «Internationalization Domains»Set up different domains for different languages:
docs.yourcompany.com (English)docs-de.yourcompany.com (German)docs-fr.yourcompany.com (French)docs-es.yourcompany.com (Spanish)CDN Integration
Заголовок раздела «CDN Integration»Configure CDN for better performance:
{ "functions": { "app/api/**/*.js": { "maxDuration": 30 } }, "regions": ["iad1", "sfo1", "fra1"], "github": { "enabled": false }}Security Best Practices
Заголовок раздела «Security Best Practices»HSTS Configuration
Заголовок раздела «HSTS Configuration»Enable HTTP Strict Transport Security:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preloadContent Security Policy
Заголовок раздела «Content Security Policy»Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; media-src 'self'; object-src 'none'; child-src 'self'; frame-ancestors 'none'; form-action 'self'; base-uri 'self';Additional Security Headers
Заголовок раздела «Additional Security Headers»X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 1; mode=blockReferrer-Policy: strict-origin-when-cross-originPermissions-Policy: geolocation=(), microphone=(), camera=()Performance Optimization
Заголовок раздела «Performance Optimization»DNS Optimization
Заголовок раздела «DNS Optimization»- Use fast DNS providers: Cloudflare, Route 53, or Google DNS
- Minimize DNS lookups: Reduce external resource dependencies
- Enable DNS prefetching:
<link rel="dns-prefetch" href="//example.com">
Caching Strategy
Заголовок раздела «Caching Strategy»# Static assetsCache-Control: public, max-age=31536000, immutable
# HTML filesCache-Control: public, max-age=0, must-revalidate
# API responsesCache-Control: public, max-age=300, s-maxage=600Monitoring and Analytics
Заголовок раздела «Monitoring and Analytics»Domain Health Monitoring
Заголовок раздела «Domain Health Monitoring»Set up monitoring for your custom domain:
// Basic uptime monitoringasync function checkDomainHealth() { try { const response = await fetch('https://docs.yourcompany.com/health'); if (response.ok) { console.log('Domain is healthy'); } else { console.error('Domain health check failed'); } } catch (error) { console.error('Domain is unreachable:', error); }}
setInterval(checkDomainHealth, 300000); // Check every 5 minutesAnalytics Configuration
Заголовок раздела «Analytics Configuration»<!-- Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GA_TRACKING_ID', { custom_map: { 'custom_parameter': 'dimension1' } });</script>Troubleshooting
Заголовок раздела «Troubleshooting»Common Issues
Заголовок раздела «Common Issues»DNS Propagation Delays
Заголовок раздела «DNS Propagation Delays»DNS changes can take up to 48 hours to fully propagate worldwide:
# Check DNS propagationdig docs.yourcompany.comnslookup docs.yourcompany.comOnline tools:
- whatsmydns.net
- dnschecker.org
SSL Certificate Issues
Заголовок раздела «SSL Certificate Issues»Common SSL problems and solutions:
- Mixed content errors: Ensure all resources use HTTPS
- Certificate mismatch: Verify domain names match certificate
- Expired certificates: Set up auto-renewal
Redirect Loops
Заголовок раздела «Redirect Loops»Prevent infinite redirects:
# Incorrecthttps://docs.yourcompany.com → https://docs.yourcompany.com
# Correcthttp://docs.yourcompany.com → https://docs.yourcompany.comPerformance Issues
Заголовок раздела «Performance Issues»Diagnose and fix performance problems:
# Test site speedcurl -w "@curl-format.txt" -o /dev/null -s "https://docs.yourcompany.com"
# Check response headerscurl -I "https://docs.yourcompany.com"Debug Tools
Заголовок раздела «Debug Tools»DNS Debugging
Заголовок раздела «DNS Debugging»# Check A recordsdig A docs.yourcompany.com
# Check CNAME recordsdig CNAME docs.yourcompany.com
# Check MX recordsdig MX yourcompany.com
# Trace DNS resolutiondig +trace docs.yourcompany.comSSL Debugging
Заголовок раздела «SSL Debugging»# Check SSL certificateopenssl s_client -connect docs.yourcompany.com:443 -servername docs.yourcompany.com
# Test SSL configurationcurl -vI https://docs.yourcompany.comMigration Strategies
Заголовок раздела «Migration Strategies»Zero-Downtime Migration
Заголовок раздела «Zero-Downtime Migration»Plan for seamless domain migration:
- Prepare new domain: Set up and test thoroughly
- Update DNS with low TTL: Reduce propagation time
- Monitor traffic: Watch for any issues
- Implement redirects: Guide users to new domain
- Update internal links: Change all references
- Notify users: Communicate the change
Migration Checklist
Заголовок раздела «Migration Checklist»- Domain ownership verified
- DNS records configured
- SSL certificate active
- Redirects implemented
- Internal links updated
- External references notified
- Analytics tracking updated
- SEO considerations addressed
- Monitoring alerts configured
- Rollback plan prepared
Best Practices
Заголовок раздела «Best Practices»- Choose meaningful subdomains: Use clear, descriptive names
- Enable HTTPS everywhere: Never serve content over HTTP
- Monitor domain health: Set up uptime monitoring
- Plan for disasters: Have backup domains ready
- Document your setup: Keep configuration records
- Regular maintenance: Review and update configurations
- Security first: Implement proper headers and policies
- Performance matters: Optimize for speed and reliability
Conclusion
Заголовок раздела «Conclusion»Setting up a custom domain for your Dockit documentation site enhances your brand presence and provides a professional experience for your users. Follow the platform-specific instructions, implement proper security measures, and monitor your domain’s health for the best results.
Remember to test thoroughly in a staging environment before making changes to production domains, and always have a rollback plan ready in case of issues.