HTTPS Setup
Overview
Section titled “Overview”HTTPS is strongly recommended for production environments. Glean doesn’t handle SSL directly, you need to use a reverse proxy.
Option 1: Caddy (Recommended)
Section titled “Option 1: Caddy (Recommended)”Caddy automatically obtains and renews Let’s Encrypt certificates with the simplest configuration.
Install Caddy
Section titled “Install Caddy”# Ubuntu/Debiansudo apt install caddy
# macOSbrew install caddyConfigure Caddyfile
Section titled “Configure Caddyfile”Create Caddyfile:
glean.yourdomain.com { reverse_proxy localhost:80}
admin.yourdomain.com { reverse_proxy localhost:3001}Start Caddy
Section titled “Start Caddy”caddy run --config CaddyfileCaddy will automatically:
- Obtain SSL certificates
- Configure HTTPS
- Auto-renew certificates
Option 2: Nginx + Certbot
Section titled “Option 2: Nginx + Certbot”Install Nginx and Certbot
Section titled “Install Nginx and Certbot”# Ubuntu/Debiansudo apt install nginx certbot python3-certbot-nginxConfigure Nginx
Section titled “Configure Nginx”Create /etc/nginx/sites-available/glean:
# Web Appserver { listen 80; server_name glean.yourdomain.com;
location / { proxy_pass http://localhost:80; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}
# Admin Dashboardserver { listen 80; server_name admin.yourdomain.com;
location / { proxy_pass http://localhost:3001; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}Enable Site
Section titled “Enable Site”sudo ln -s /etc/nginx/sites-available/glean /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginxObtain SSL Certificate
Section titled “Obtain SSL Certificate”sudo certbot --nginx -d glean.yourdomain.com -d admin.yourdomain.comCertbot will automatically:
- Obtain certificates
- Configure Nginx
- Set up auto-renewal
Update CORS Configuration
Section titled “Update CORS Configuration”After configuring HTTPS, update CORS settings:
# Edit .env fileCORS_ORIGINS='["https://glean.yourdomain.com", "https://admin.yourdomain.com"]'Restart backend service:
docker compose restart backendUsing Self-Signed Certificates
Section titled “Using Self-Signed Certificates”For testing only, not recommended for production.
Generate Certificate
Section titled “Generate Certificate”openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ -keyout /etc/ssl/private/glean.key \ -out /etc/ssl/certs/glean.crt \ -subj "/CN=glean.local"Nginx Configuration
Section titled “Nginx Configuration”server { listen 443 ssl; server_name glean.local;
ssl_certificate /etc/ssl/certs/glean.crt; ssl_certificate_key /etc/ssl/private/glean.key;
location / { proxy_pass http://localhost:80; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}Security Best Practices
Section titled “Security Best Practices”SSL Configuration Optimization
Section titled “SSL Configuration Optimization”# Add to server blockssl_protocols TLSv1.2 TLSv1.3;ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;ssl_prefer_server_ciphers off;
# HSTSadd_header Strict-Transport-Security "max-age=63072000" always;Force HTTPS Redirect
Section titled “Force HTTPS Redirect”server { listen 80; server_name glean.yourdomain.com; return 301 https://$server_name$request_uri;}Verify Configuration
Section titled “Verify Configuration”Check SSL Certificate
Section titled “Check SSL Certificate”# Verify with curlcurl -v https://glean.yourdomain.com
# Check with opensslopenssl s_client -connect glean.yourdomain.com:443Online Testing
Section titled “Online Testing”Use SSL Labs to check SSL configuration rating.
Common Issues
Section titled “Common Issues”Certificate Renewal Failed
Section titled “Certificate Renewal Failed”# Manual renewalsudo certbot renew
# Check renewal statussudo certbot certificatesMixed Content Warning
Section titled “Mixed Content Warning”Ensure all resources are loaded via HTTPS, check browser console for mixed content warnings.
Getting Real IP Behind Reverse Proxy
Section titled “Getting Real IP Behind Reverse Proxy”Ensure Nginx configuration correctly passes X-Forwarded-For and X-Real-IP headers.
Next Steps
Section titled “Next Steps”- Configuration - Environment variable settings
- Troubleshooting - Common issue resolution