How Custom Domains Work
Zipline can serve files from multiple domains simultaneously. When configured:- Files can be accessed via any configured domain
- You can set a default domain for new uploads
- Users can choose which domain to use for their uploads
- All domains must point to your Zipline instance
Configuration
Setting the Default Domain
The default domain is used for generating URLs when uploading files:- File URLs returned by the API
- Shortened URLs
- Email notifications and webhooks
Configuring Multiple Domains
You can configure additional domains that Zipline will accept requests from:The
DOMAINS configuration is stored in the database (see prisma/schema.prisma:149). You can also manage domains through the admin dashboard after initial setup.DNS Configuration
Add DNS A/AAAA records
For each domain, create DNS records pointing to your server:A Record (IPv4):AAAA Record (IPv6):
Reverse Proxy Configuration
Configure your reverse proxy to accept requests from all domains.Nginx
Caddy
Apache
SSL Certificates for Multiple Domains
Let’s Encrypt with Certbot
Obtain a certificate covering all domains:Caddy (Automatic)
Caddy automatically obtains and manages certificates for all configured domains:Cloudflare
If using Cloudflare:- Add all domains to your Cloudflare account
- Enable SSL/TLS (Full or Full (strict) mode)
- Configure DNS records for each domain
- Cloudflare automatically provides SSL certificates
Use Cases
Separate Upload and CDN Domains
Use different domains for uploads and file delivery:uploads.example.com- Admin interface and uploadscdn.example.com- Public file access
Multiple Brands/Projects
Use different domains for different projects:Regional Domains
Provide region-specific domains:Managing Domains via Admin Dashboard
After initial setup, you can manage domains through the Zipline admin interface:- Log in as an administrator
- Navigate to Settings → Server
- Scroll to Domains section
- Add or remove domains as needed
- Click Save
HTTPS URL Generation
When using custom domains with HTTPS:- File URLs use
https://instead ofhttp:// - Correct domain is used in generated URLs
- Proxy headers are respected
Wildcard Domains
For subdomain-based file serving (e.g.,user1.files.example.com, user2.files.example.com):
DNS Configuration
Create a wildcard DNS record:Reverse Proxy Configuration
Nginx:Wildcard SSL Certificate
Certbot with DNS challenge:Wildcard certificates require DNS validation. You’ll need to add a TXT record during the challenge.
Troubleshooting
Files not accessible via new domain
Files not accessible via new domain
Check:
- DNS records point to correct server IP:
nslookup your-domain.com - Domain is listed in
DOMAINSconfiguration or admin dashboard - Reverse proxy accepts requests for the domain
- SSL certificate covers the domain
- Firewall allows traffic on ports 80/443
Wrong domain in file URLs
Wrong domain in file URLs
This happens when
CORE_DEFAULT_DOMAIN isn’t set correctly:- Verify
CORE_DEFAULT_DOMAINmatches your primary domain - Restart Zipline after changing configuration
- Clear any cached URLs in ShareX or other clients
SSL certificate errors on additional domains
SSL certificate errors on additional domains
- Ensure SSL certificate covers all domains (use SAN certificate or separate certs)
- For Let’s Encrypt, include all domains in the
certbotcommand - For Caddy, it automatically handles multiple domains
- Check certificate details:
openssl s_client -connect domain.com:443 -servername domain.com
Cloudflare 'too many redirects' error
Cloudflare 'too many redirects' error
This occurs when Cloudflare SSL mode is misconfigured:
- Set Cloudflare SSL mode to Full or Full (strict)
- Ensure
CORE_RETURN_HTTPS_URLS=trueis set - Verify reverse proxy doesn’t force HTTP redirects
Domain works but shows wrong content
Domain works but shows wrong content
- Check reverse proxy
Hostheader is being passed:proxy_set_header Host $host; - Verify
CORE_TRUST_PROXY=trueis set - Ensure no conflicting server blocks in reverse proxy config
Best Practices
- Use descriptive domains:
files.example.com,cdn.example.cominstead of random subdomains - Plan your structure: Decide on domain purposes before deploying
- Document your setup: Keep track of which domains serve which purposes
- Monitor all domains: Set up monitoring for all configured domains
- Consistent SSL: Ensure all domains have valid SSL certificates
- DNS TTL: Use reasonable TTL values (e.g., 300-3600 seconds) for easier updates