Reverse Proxy

Learn how to set up a reverse proxy for VoxelDash with Nginx, Apache, or Caddy

Why Use a Reverse Proxy?

Setting up a reverse proxy for VoxelDash provides several benefits:

  • SSL/TLS Encryption: Secure your dashboard with HTTPS
  • Custom Domain: Access your dashboard via a domain name instead of an IP address
  • Security: Hide the backend port and add an extra layer of protection
  • WebSocket Support: Properly proxy the real-time console and live updates

Configuration

Nginx
Apache
Caddy
Traefik

Prerequisites

Install Nginx on your server:

sudo apt update
sudo apt install nginx

Configuration

Create a new configuration file for VoxelDash:

sudo nano /etc/nginx/sites-available/voxeldash

Add the following configuration:

server {
    listen 80;
    server_name voxeldash.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:7867;
        proxy_http_version 1.1;
        
        # WebSocket support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        
        # Pass original headers
        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;
        
        # Timeout settings for long-running connections
        proxy_read_timeout 86400;
        proxy_send_timeout 86400;
    }
}

Enable the site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/voxeldash /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Adding SSL with Certbot

Install Certbot and obtain a certificate:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d voxeldash.yourdomain.com

Certbot will automatically modify your Nginx configuration to use HTTPS.

Firewall Configuration

After setting up a reverse proxy, you should block direct access to port 7867 from external networks:

UFW
iptables
# Allow HTTP/HTTPS
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Block external access to VoxelDash port (allow only localhost)
sudo ufw deny 7867/tcp

# Enable the firewall
sudo ufw enable

Troubleshooting

WebSocket Connection Failed

If the console or real-time features aren't working:

  1. Check your proxy configuration - Ensure WebSocket upgrade headers are being passed correctly
  2. Verify timeout settings - WebSocket connections need long timeouts
  3. Check browser console - Look for WebSocket connection errors

502 Bad Gateway

If you're getting a 502 error:

  1. Verify VoxelDash is running - Check if the dashboard is accessible at http://localhost:7867
  2. Check the proxy pass URL - Ensure the backend URL is correct
  3. Review logs - Check your reverse proxy logs for more details:
    # Nginx
    sudo tail -f /var/log/nginx/error.log
    
    # Apache
    sudo tail -f /var/log/apache2/error.log
    
    # Caddy
    sudo journalctl -u caddy -f
    

SSL Certificate Issues

If you're having trouble with SSL:

  1. Check DNS - Ensure your domain points to your server's IP
  2. Verify ports - Port 80 and 443 must be open for Certbot validation
  3. Check certificate status:
    sudo certbot certificates