Skip to content

Reverse proxies and HTTPS

Put Avenvail behind Caddy, nginx, Traefik or Nginx Proxy Manager, and what to know about Cloudflare.

Run Avenvail behind a reverse proxy that terminates HTTPS and forwards everything on one host name to port 8080. Avenvail serves the dashboard, API, share pages (/s/), deletion pages (/d/) and health checks (/health/) from that one origin. Do not split them across hosts or paths.

Whatever proxy you use:

  • Set Avenvail__BaseUrl to the public https:// address.
  • Allow request bodies at least as large as Avenvail__MaxUploadBytes (or, if only the web app uploads large files, Avenvail__ResumableUploads__ChunkBytes), and long enough timeouts for your slowest upload. Disable request buffering if the proxy supports it, so uploads stream.
  • Do not compress or rewrite responses from /s/*/raw. Avenvail marks them no-transform; most proxies respect that.
  • If Avenvail is reachable only through the proxy, set ASPNETCORE_FORWARDEDHEADERS_ENABLED=true so it sees real client addresses (see Configuration).

Caddy

Caddy gets and renews certificates by itself, and has no body size limit by default.

files.example.com {
    encode zstd gzip
    header Strict-Transport-Security "max-age=31536000"
    reverse_proxy avenvail:8080
}

The DigitalOcean installer sets this up for you.

nginx

server {
    listen 443 ssl;
    http2 on;
    server_name files.example.com;
    # ssl_certificate / ssl_certificate_key ...

    client_max_body_size 100m;      # at least Avenvail__MaxUploadBytes
    proxy_request_buffering off;
    proxy_read_timeout 300s;
    proxy_send_timeout 300s;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

nginx's default client_max_body_size is 1 MB, which rejects most screenshots with 413.

Nginx Proxy Manager

Add a proxy host for your domain pointing at avenvail port 8080 (or the host's IP), request a certificate on the SSL tab, and under Advanced add:

client_max_body_size 100m;
proxy_request_buffering off;

Traefik

services:
  avenvail:
    image: ghcr.io/avenvail/avenvail:0.7
    labels:
      - traefik.enable=true
      - traefik.http.routers.avenvail.rule=Host(`files.example.com`)
      - traefik.http.routers.avenvail.entrypoints=websecure
      - traefik.http.routers.avenvail.tls.certresolver=letsencrypt
      - traefik.http.services.avenvail.loadbalancer.server.port=8080

Traefik does not limit body size unless you add a buffering middleware. If you do, set maxRequestBodyBytes to at least Avenvail__MaxUploadBytes.

Cloudflare proxy and Cloudflare Tunnel

Cloudflare's proxy (the orange cloud) and Cloudflare Tunnel cap request bodies by plan: 100 MB on Free and Pro at the time of writing. Larger uploads fail at Cloudflare with 413 before they reach Avenvail, whatever Avenvail__MaxUploadBytes says. The web app sends files larger than Avenvail__ResumableUploads__ChunkBytes (8 MiB) in pieces, so browser uploads are not affected and Avenvail__MaxUploadBytes can go above the limit. ShareX and other clients that use the single-request /api/v1/uploads endpoint are still capped by Cloudflare, so either keep Avenvail__MaxUploadBytes at or below your plan's limit so the error comes from Avenvail, or serve Avenvail on a DNS-only (grey cloud) record. Cloudflare also ends a request that waits more than 100 seconds for a response; when finishing a very large upload takes longer, the web app checks back and picks up the result.

Tailscale or LAN only

For a private installation, set Avenvail__BaseUrl to the address you use (for example https://avenvail.tailnet-name.ts.net with tailscale serve). Links shared from it only work for people on the same network.