AISBF Logo AISBF

AI Service Broker Framework — AI Should Be Free

CoderAI documentation · source-backed from Nexlab/coderai

CoderAI reverse proxy deployment

Serve CoderAI behind nginx on a subdomain or sub-path with correct forwarded headers, upload limits, and SSE streaming settings.

Proxy basics

CoderAI can live at a subdomain/root location or under a sub-path such as https://example.com/coderai/. For AI workloads, configure large upload limits, long timeouts, and disabled buffering for Server-Sent Events.

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_set_header X-Forwarded-Host  $host;

client_max_body_size 1024m;
proxy_read_timeout   3600s;
proxy_send_timeout   3600s;
proxy_buffering      off;

Subdomain/root deployment

server {
    listen 443 ssl;
    server_name coderai.example.com;
    client_max_body_size 1024m;
    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_http_version 1.1;
        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_set_header X-Forwarded-Host  $host;
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
        proxy_buffering off;
    }
}

You can optionally pin the public URL by starting CoderAI with --url https://coderai.example.com.

Sub-path deployment

location /coderai/ {
    proxy_pass http://127.0.0.1:8000/;
    proxy_http_version 1.1;
    proxy_set_header Host              $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host  $host;
    proxy_set_header X-Forwarded-Prefix /coderai;
    proxy_read_timeout 3600s;
    proxy_buffering off;
}

The key line is X-Forwarded-Prefix. CoderAI reads it into ASGI root_path so redirects, template links, ROOT_PATH, and generated file URLs resolve under the mount.

Why these settings matter

  • client_max_body_size: image/audio/video uploads can be large.
  • proxy_read_timeout and proxy_send_timeout: generations and renders can run for minutes.
  • proxy_buffering off: chat streams and progress events use SSE and need immediate flushing.
  • X-Forwarded-Proto, Host, and X-Forwarded-Host: generated URLs and redirects need the public origin.