Skip to main content

Overview

Running Borg UI behind a reverse proxy enables:
  • SSL/TLS encryption (HTTPS)
  • Custom domains (e.g., backups.yourdomain.com)
  • Subfolder deployment (e.g., yourdomain.com/borg)
  • Additional security features
  • Integration with existing infrastructure

Nginx

Root Path Configuration

For serving Borg UI at the root of a domain (backups.yourdomain.com):

Subfolder Configuration

For serving Borg UI in a subfolder (yourdomain.com/borg):
1

Configure BASE_PATH in Borg UI

Set the BASE_PATH environment variable:Docker:
Docker Compose:
Unraid: Add environment variable:
  • Must start with / (e.g., /borg not borg)
  • No trailing slash (e.g., /borg not /borg/)
  • Rebuild container after setting: docker-compose up -d --build
2

Configure Nginx

Note the trailing slash in proxy_pass http://localhost:8081/; - this is required for subfolder setups.
3

Test and reload

Nginx Proxy Manager

Popular with Unraid users and home lab setups:
1

Add Proxy Host

  1. Open Nginx Proxy Manager interface
  2. Click Proxy HostsAdd Proxy Host
2

Configure Details tab

3

Configure SSL tab

Or use existing certificate if available.
4

Configure Advanced tab

5

Save and test

Save the proxy host and access https://backups.yourdomain.com

Subfolder with NPM

For subfolder deployment (yourdomain.com/borg):
  1. Set BASE_PATH=/borg in Borg UI container (see above)
  2. In NPM Proxy Host:
  3. In Advanced tab:

Traefik

Root Path Configuration

Using Docker labels for Traefik v2/v3:
docker-compose.yml

Subfolder Configuration

1

Set BASE_PATH

2

Configure Traefik labels

3

Rebuild container

Traefik File Configuration

Alternatively, using traefik.yml or dynamic configuration:
traefik-dynamic.yml

Caddy

Root Path Configuration

Caddyfile

Subfolder Configuration

Caddyfile

Apache

Root Path Configuration

Enable required modules:

Subfolder Configuration

Configuration Summary

BASE_PATH Environment Variable

Important rules for BASE_PATH:
  • Must start with / (e.g., /borg not borg)
  • No trailing slash (e.g., /borg not /borg/)
  • Requires container rebuild: docker-compose up -d --build

Common Proxy Settings

Essential headers for all reverse proxy configurations:

Testing

Verify Configuration

1

Test reverse proxy config

Nginx:
Apache:
Caddy:
2

Check SSL certificate

Verify the certificate is valid and served correctly.
3

Test WebSocket connection

Open browser developer tools (F12) → Network tab → WS filter. Navigate to Borg UI and start a backup. You should see WebSocket connections for real-time updates.
4

Test large operations

Perform a backup or restore operation. Verify it doesn’t timeout (600s should be sufficient for most operations).

Troubleshooting

502 Bad Gateway

Cause: Reverse proxy can’t reach Borg UI container. Solutions:
  1. Verify Borg UI is running:
  2. Check if port 8081 is accessible:
  3. Verify network connectivity between proxy and container
  4. Check proxy logs for connection errors

404 Not Found (Subfolder Setup)

Cause: BASE_PATH not configured correctly. Solutions:
  1. Verify BASE_PATH is set in container:
  2. Ensure BASE_PATH starts with / and has no trailing slash
  3. Rebuild container after setting BASE_PATH:
  4. Check proxy configuration matches BASE_PATH value

Static Assets Not Loading

Cause: Incorrect proxy_pass configuration or missing BASE_PATH. Solutions:
  1. For subfolder setups, ensure trailing slash in proxy_pass:
  2. Verify BASE_PATH is set and container rebuilt
  3. Check browser console for 404 errors on assets

WebSocket Connection Failed

Cause: Missing WebSocket proxy headers. Solutions:
  1. Add WebSocket headers (see examples above)
  2. Verify HTTP version is 1.1:
  3. Check firewall allows WebSocket connections

Operation Timeouts

Cause: Proxy timeout too short for long-running operations. Solutions:
  1. Increase proxy timeouts to 600s (see examples above)
  2. Increase Borg operation timeouts in container:
  3. Check both proxy and container logs for timeout errors

Security Best Practices

  • Use TLS 1.2 or higher
  • Disable weak ciphers
  • Enable HSTS
  • Use valid SSL certificates (Let’s Encrypt recommended)
  • Enable HTTP/2 for better performance
  • Use firewall rules to limit access
  • Consider IP whitelisting for admin interface
  • Enable fail2ban for brute force protection
  • Use strong passwords
  • Consider adding HTTP basic auth at proxy level
Always include:
  • Strict-Transport-Security
  • X-Content-Type-Options
  • X-Frame-Options
  • X-XSS-Protection
Implement rate limiting at reverse proxy level:Nginx:
Traefik:

Next Steps

Docker

Simple deployment with docker run

Docker Compose

Recommended production setup