Reverse Proxy
A reverse proxy is a small program that stands in front of Staaash. People visit a name like https://drive.example.com. The proxy handles the secure HTTPS part, then passes the visit to Staaash.
You do not need one to use Staaash at home. You want one when you reach your drive from outside the house, or you want a nice name and a padlock in the browser.
Each release ships a ready setup with Caddy, which gets and renews HTTPS certificates by itself. If you already run a proxy, skip to Your own proxy.
Before you start
Section titled “Before you start”- You own a domain name, such as
example.com, and pointdrive.example.comat your server’s public address. - Your router sends ports 80 and 443 to your server. Do not forward port 2113.
HTTPS with the release files
Section titled “HTTPS with the release files”-
Download
compose.https.ymlandCaddyfilefrom the release Assets. Put them next todocker-compose.yml. -
Add or change these lines in
.env:STAAASH_PUBLIC_URL=https://drive.example.comSTAAASH_PORT=127.0.0.1:2113COMPOSE_PATH_SEPARATOR=,COMPOSE_FILE=docker-compose.yml,compose.https.ymlUse your own name instead of
drive.example.com.STAAASH_PORT=127.0.0.1:2113keeps Staaash’s own port on this computer, so visits from the network go through Caddy. The last two lines tell Docker to use both files. They work the same on Linux, macOS and Windows. -
Start it:
docker compose up -d
Open https://drive.example.com. You should see Staaash with a padlock. Share links now use this name.
You don’t need to edit the Caddyfile. It reads the address from STAAASH_PUBLIC_URL. When you update Staaash, download the new compose.https.yml and Caddyfile along with docker-compose.yml.
HTTP/3 is off in this Caddyfile. In our tests it used about 2.5 times more processing per megabyte and uploaded about 45% slower than HTTP/2.
Your own proxy
Section titled “Your own proxy”Point your proxy at port 2113 and set STAAASH_PUBLIC_URL to the public address. The examples below were tested with sign-in and a 40 MB upload. The browser sends files under 100 MiB in one request and bigger ones in pieces of up to 32 MiB, so the proxy must accept request bodies of at least 128 MiB.
A Caddy running on the same computer needs only this:
drive.example.com { reverse_proxy 127.0.0.1:2113}Traefik
Section titled “Traefik”If Traefik already runs in Docker with a websecure entry point on port 443 and a certificate resolver, add these labels to the staaash service. Put the labels in a compose.override.yml next to docker-compose.yml, so the next update does not replace them:
services: staaash: labels: traefik.enable: "true" traefik.http.routers.staaash.rule: Host(`drive.example.com`) traefik.http.routers.staaash.entrypoints: websecure traefik.http.routers.staaash.tls.certresolver: letsencrypt traefik.http.services.staaash.loadbalancer.server.port: "2113"Use the name of your own certificate resolver instead of letsencrypt. Traefik and Staaash must share a Docker network. Traefik passes the original address and HTTPS on by itself, and it has no upload size limit.
Nginx Proxy Manager
Section titled “Nginx Proxy Manager”Add a proxy host:
- Domain names:
drive.example.com. - Scheme:
http. Forward hostname / IP: your server’s address, orstaaashif Nginx Proxy Manager shares a Docker network with Staaash. Forward port:2113. - Turn on Websockets support and Block common exploits.
- On the SSL tab, request a new certificate and turn on Force SSL.
Nothing else is needed. Nginx Proxy Manager passes the original address and HTTPS on, and it accepts uploads up to 2000 MB per request.
Rules for any proxy
Section titled “Rules for any proxy”Keep these rules, or sign-in and uploads fail on purpose:
- Use one address everywhere. Do not open Staaash at
https://drive.example.comand send requests to a LAN address or another port. - Pass on the original
Host. Staaash checks that the browser’s address matches the address it was called with. - Say the visit was HTTPS. When the proxy talks to Staaash over plain HTTP, it must send
X-Forwarded-Proto: https. Caddy does this by itself.
When the proxy runs on the same computer, set STAAASH_PORT=127.0.0.1:2113 in .env, so nobody can skip the proxy.
Fast uploads at home
Section titled “Fast uploads at home”If uploads are slow from inside your home but fine from outside, your devices are probably sending them out to the internet and back in through the router. Keep the same address, and make it point straight at your server when you are home.
-
Check the route. On a Windows computer at home, run
Resolve-DnsName drive.example.com. On macOS or Linux, rundig +short drive.example.com. If you see your server’s home address, such as192.168.1.10, the route is already local. If you see your public address, continue. -
Add a local DNS record. In your router, AdGuard Home, Pi-hole or other home DNS, point
drive.example.comto the server’s home address. If the name also has an IPv6 (AAAA) record, add a home answer for that too. -
Make the proxy answer on port 443 at home. If your router sends public port 443 to port 443 on the server, you are done. If it sends it to another port, such as 8443, the proxy must also listen on 443 at the home address. With your own Caddy, add a second block:
Caddyfile https://drive.example.com:443 {bind 192.168.1.10reverse_proxy 127.0.0.1:2113} -
Check it. Clear the DNS cache (
Clear-DnsClientCacheon Windows), resolve the name again, and openhttps://drive.example.com. The padlock should still be there, and the address bar should not change.
This only speeds up devices that use your home DNS. It does not change uploads from outside.
If sign-in or uploads fail after any of this, see Sign-in or uploads fail behind a proxy in Troubleshooting.