Why HTTPS Matters for Sparklytics
Secure Cookie Flag
Secure Cookie Flag
Data Integrity
Data Integrity
Analytics collection endpoints (
/api/collect) transmit:- Pageview URLs (may contain sensitive paths)
- Referrer information
- Custom event properties
Modern Browser Requirements
Modern Browser Requirements
Many browsers require HTTPS for:
localStorageaccess (used by SDK for visitor ID)- Service workers (future features)
- Secure contexts for newer JavaScript APIs
Automatic HTTPS with Caddy
Caddy obtains and renews certificates automatically — zero manual configuration required.Setup
Configure DNS
Point your domain to your server’s IP:Wait for DNS propagation (can take up to 48 hours, usually minutes).
Start services
- Obtains a Let’s Encrypt certificate
- Configures HTTPS on port 443
- Redirects HTTP (port 80) to HTTPS
- Renews certificates before expiry
How Caddy Handles Certificates
- Challenge type: HTTP-01 (requires port 80 accessible)
- Storage: Certificates stored in Docker volume
caddy-data - Renewal: Automatic, checks daily, renews at 30 days before expiry
- Rate limits: Let’s Encrypt allows 50 certificates per domain per week
Manual HTTPS with Certbot (Nginx/Standalone)
For Nginx or standalone deployments without Caddy.Install Certbot
Obtain Certificate with Nginx Plugin
Run Certbot
- Verify domain ownership via HTTP-01 challenge
- Obtain certificate from Let’s Encrypt
- Automatically modify your Nginx config
- Set up HTTP to HTTPS redirect
Standalone Mode (Without Nginx Plugin)
If you want to manually configure Nginx:SSL/TLS Best Practices
Modern TLS Configuration
Caddy (Automatic)
Caddy uses secure defaults automatically. No manual TLS configuration needed.Nginx (Manual)
Security Headers
Add these headers to enforce HTTPS and prevent common attacks:Caddy
Nginx
Certificate Renewal
Automatic Renewal
- Caddy
- Certbot (systemd)
- Certbot (cron)
Caddy handles renewal automatically. Check logs to verify:
Manual Renewal
To force renewal immediately:Custom/Self-Signed Certificates
For internal deployments or testing.Generate Self-Signed Certificate
Use with Nginx
Troubleshooting
Let's Encrypt rate limit exceeded
Let's Encrypt rate limit exceeded
Error:
too many certificates already issuedSolution:- Wait one week for rate limit reset
- Use staging environment for testing:
certbot --staging - Let’s Encrypt allows 50 certs per domain per week
DNS validation fails
DNS validation fails
Error:
DNS problem: NXDOMAINSolution:- Verify DNS is configured:
dig analytics.example.com - Wait for DNS propagation (up to 48 hours)
- Ensure no conflicting DNS records
Port 80 or 443 already in use
Port 80 or 443 already in use
Error:
Address already in useSolution:Certificate not trusted on clients
Certificate not trusted on clients
Cause: Missing intermediate certificates.Solution:
- Ensure using
fullchain.pemnotcert.pem - Caddy handles this automatically
- For Nginx:
ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
Sparklytics HTTPS Configuration
After setting up HTTPS at the reverse proxy level:Testing Your HTTPS Setup
SSL Labs test
Comprehensive SSL/TLS analysis:https://www.ssllabs.com/ssltest/analyze.html?d=analytics.yourdomain.comAim for an A or A+ rating.
Security headers check
https://securityheaders.com/?q=https://analytics.yourdomain.comShould show HSTS and other security headers.
Next Steps
Reverse Proxy Setup
Complete reverse proxy configurations
Performance Tuning
Optimize for production workloads