Reverse Proxy
Configure nginx or Caddy as a reverse proxy for DorkOS
Reverse Proxy
DorkOS uses Server-Sent Events (SSE) for real-time streaming. Reverse proxy configuration must account for SSE's long-lived connections and disable response buffering.
Standard proxy settings will break SSE streaming. The configurations below include the required SSE-specific directives.
Proxy Configuration
Caddy handles HTTPS certificates automatically and has good SSE support out of the box.
dorkos.example.com {
reverse_proxy localhost:4242 {
flush_interval -1
}
}flush_interval -1 disables response buffering, which is required for SSE streams.
server {
listen 443 ssl;
server_name dorkos.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:4242;
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;
# Required for SSE: disable buffering and set long timeouts
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
proxy_set_header Connection '';
chunked_transfer_encoding off;
}
}Key SSE Settings (nginx)
Prop
Type
Common Issues
SSE events arrive in batches instead of real-time
Cause: Response buffering is enabled in the proxy.
Fix: Set proxy_buffering off (nginx) or flush_interval -1 (Caddy).
Connection drops after 60 seconds
Cause: Default proxy timeout is too short for SSE.
Fix: Increase proxy_read_timeout to at least 3600s.
502 Bad Gateway on long requests
Cause: Upstream timeout is shorter than the Claude response time.
Fix: Increase both proxy_read_timeout and proxy_send_timeout.
HTTPS with Let's Encrypt
Point your domain's DNS to the server and Caddy obtains and renews certificates automatically — no additional configuration needed.
dorkos.example.com {
reverse_proxy localhost:4242 {
flush_interval -1
}
}sudo certbot --nginx -d dorkos.example.comCertbot modifies your nginx config to add SSL directives and sets up automatic renewal.