Quick Start
To enable automatic HTTPS, you only need to set one configuration parameter:- Listen on port 443 for HTTPS connections
- Automatically request a certificate from Let’s Encrypt
- Renew the certificate before it expires
- Cache the certificate for instant restarts
Make sure your domain’s DNS A/AAAA record points to your server’s IP address before enabling HTTPS.
How It Works
When you sethttps_domain, SQLPage uses the ACME protocol with the TLS-ALPN-01 challenge to automatically obtain a certificate from Let’s Encrypt.
The first time you start SQLPage with HTTPS enabled:
- SQLPage contacts Let’s Encrypt’s servers
- Let’s Encrypt verifies you control the domain by connecting to port 443
- SQLPage completes the challenge and receives a certificate
- The certificate is cached locally for future use
Configuration Parameters
Basic HTTPS Settings
Domain name to request a certificate for. Setting this parameter will automatically make SQLPage listen on port 443 and request an SSL certificate.The server will take a little bit longer to start the first time it has to request a certificate.Example:
myapp.example.comThe email address to use when requesting a certificate from Let’s Encrypt. Let’s Encrypt may use this email to send expiration notices and important updates about your certificate.Example:
[email protected]A writable directory where to cache the certificates, so that SQLPage can serve HTTPS traffic immediately when it restarts.The cached certificate files are stored securely and should not be committed to version control.
The URL of the ACME directory to use when requesting a certificate. The default points to Let’s Encrypt’s production environment.For testing, you can use Let’s Encrypt’s staging environment:
https://acme-staging-v02.api.letsencrypt.org/directoryComplete Example
Configuration file (sqlpage/sqlpage.json):
Testing with Let’s Encrypt Staging
Let’s Encrypt has rate limits to prevent abuse. When testing your HTTPS setup, use the staging environment to avoid hitting these limits:Requirements
Port 443 must be accessible
Port 443 must be accessible
Let’s Encrypt needs to connect to port 443 on your server to verify you control the domain. Make sure:
- Your firewall allows incoming connections on port 443
- Your router forwards port 443 to your server (if behind NAT)
- No other service is already using port 443
DNS must point to your server
DNS must point to your server
Before requesting a certificate, make sure your domain’s DNS A (IPv4) or AAAA (IPv6) record points to your server’s IP address.Check DNS resolution:Wait for DNS propagation (can take up to 48 hours, usually much faster).
Certificate cache directory must be writable
Certificate cache directory must be writable
SQLPage needs to write certificate files to the cache directory. Make sure the directory exists and is writable:The directory should only be readable by the user running SQLPage.
One certificate per domain
One certificate per domain
Each
https_domain value requests a separate certificate. If you want to serve multiple domains, you’ll need to:- Use a reverse proxy (like nginx or Caddy) in front of SQLPage
- Or run multiple SQLPage instances
- Or use a wildcard certificate (requires DNS-01 challenge, not supported by SQLPage’s built-in HTTPS)
Using with OIDC Authentication
When using OpenID Connect (OIDC) for authentication, thehost parameter should match your HTTPS domain:
If
https_domain is set, you don’t need to also set host - SQLPage will use https_domain for OIDC redirects.Manual Certificate Management
If you prefer to manage certificates yourself (e.g., using Certbot, or if you already have a certificate), you can use a reverse proxy like nginx or Caddy in front of SQLPage.Using nginx
nginx configuration:Using Caddy
Caddy automatically handles HTTPS certificates, similar to SQLPage: Caddyfile:Troubleshooting
Certificate Request Fails
Error: “Failed to request certificate from Let’s Encrypt”- Check domain DNS - Verify your domain points to your server’s IP
- Check port 443 accessibility - Use an online port checker
- Check logs - Set
RUST_LOG=sqlpage=debugto see detailed error messages - Try staging first - Use staging environment to test your setup
- Check rate limits - You may have hit Let’s Encrypt’s rate limits
”Address already in use” Error
If another service is using port 443:Certificate Not Renewing
Let’s Encrypt certificates expire after 90 days. SQLPage automatically renews them, but if renewal fails:- Check certificate cache directory - Ensure it’s writable
- Check logs - Look for renewal errors
- Delete cached certificate - Remove files from
https_certificate_cache_dirto force a fresh request - Check Let’s Encrypt status - Visit https://letsencrypt.status.io/
Browser Shows Security Warning
If you see “Your connection is not private”:- Using staging environment? - Switch to production ACME directory
- Domain mismatch - Make sure you’re accessing the exact domain in
https_domain - Certificate not yet issued - Wait for SQLPage to complete the first certificate request
- Clock skew - Check your server’s time is accurate
Docker Considerations
When running SQLPage in Docker:Port Mapping
Map port 443 from the container to the host:Volume for Certificate Cache
Mount a volume for the certificate cache to persist across container restarts:Docker Compose Example
Security Best Practices
Always use HTTPS in production
Never serve sensitive data over plain HTTP. Set
https_domain to enable automatic HTTPS.Use strong cipher suites
SQLPage uses modern, secure cipher suites by default. No additional configuration needed.
Monitor certificate expiration
While SQLPage auto-renews certificates, monitor your email for expiration notices from Let’s Encrypt.
Test your SSL configuration
Use SSL Labs to test your HTTPS configuration.
Related Topics
Configuration Overview
Learn about all configuration options
OIDC Authentication
Set up Single Sign-On with OpenID Connect
Deployment
Deploy SQLPage to production
Reverse Proxy Setup
Use nginx or Caddy with SQLPage