Skip to content

Reverse Proxy Setup

Configure Nginx or Caddy to serve RasnuCloud over HTTPS from your domain.


Nginx

Create /etc/nginx/sites-available/rasnucloud with the following configuration, replacing rasnucloud.mycompany.com with your domain:

nginx
server {
    listen 80;
    server_name rasnucloud.mycompany.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name rasnucloud.mycompany.com;

    ssl_certificate /etc/letsencrypt/live/rasnucloud.mycompany.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/rasnucloud.mycompany.com/privkey.pem;

    location / {
        proxy_pass http://localhost:8000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        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;
        proxy_read_timeout 300s;
    }
}

Enable it and install an SSL certificate:

bash
ln -s /etc/nginx/sites-available/rasnucloud /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
certbot --nginx -d rasnucloud.mycompany.com

Caddy

If you prefer Caddy, create a Caddyfile:

caddy
rasnucloud.mycompany.com {
    reverse_proxy localhost:8000
}

Caddy handles SSL automatically. Start it with:

bash
caddy run --config /etc/caddy/Caddyfile

WebSocket Support

RasnuCloud uses WebSockets for real-time terminal output. Both Nginx and Caddy configs above are already configured to handle WebSocket upgrades correctly.

If you're using a different proxy (HAProxy, Traefik, AWS ALB), ensure that WebSocket connections (Upgrade: websocket) are proxied correctly and the connection timeout is set to at least 60 seconds.

Released under the MIT License.