Skip to content

Commit f09aa06

Browse files
feat(installer): expose a friendly WebDAV path so the drive is named, not "dav"
The setup wizard now adds an /OpenCoper/ nginx location (both topologies) that proxies to the API's /dav/ with X-Forwarded-Prefix, and writes WEBDAV_NAME to .env (kept in sync via a single DAV_NAME variable). Mounting https://<host>/OpenCoper/ makes Windows Explorer label the network drive "OpenCoper" instead of "dav" (it names drives from the URL's last segment). The existing /api/dav (or /dav) mount keeps working. Docs note the installer does this automatically.
1 parent ab366b4 commit f09aa06

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

‎docs/API.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ The name a client shows for the mount depends on the client:
130130
- **Windows Explorer ignores the advertised name** and labels the mapped drive from the **last
131131
segment of the URL** you mounted. So `…/api/dav/` shows up as *“dav (\\host@SSL\DavWWWRoot\…)”*.
132132
To get a custom label like **OpenCoper**, expose WebDAV under a path ending in that word and
133-
mount *that* URL — the server already rewrites hrefs from `X-Forwarded-Prefix`:
133+
mount *that* URL — the server already rewrites hrefs from `X-Forwarded-Prefix`. **The guided
134+
installer (`scripts/setup-wizard.sh`) already adds this `/OpenCoper/` location for you**; mount
135+
`https://<host>/OpenCoper/`. To wire it by hand:
134136

135137
```nginx
136138
# Mount https://<host>/OpenCoper/ → Windows labels the drive "OpenCoper"

‎scripts/setup-wizard.sh‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ TOPO="$(ask 'Choose 1, 2 or 3' '1')"
123123

124124
WEB_DOMAIN=''; API_DOMAIN=''; APP_URL=''; NEXT_PUBLIC_API_URL=''
125125
SETUP_NGINX=false; SETUP_TLS=false
126+
# Friendly WebDAV mount name: used both for WEBDAV_NAME (.env, the advertised DAV:displayname) and
127+
# for the nginx location path, so the Windows network drive shows as this instead of "dav".
128+
DAV_NAME='OpenCoper'
126129
case "$TOPO" in
127130
1)
128131
WEB_DOMAIN="$(ask 'App domain' 'copper.forgenet.fr')"
@@ -423,6 +426,9 @@ umask 077
423426
printf 'CLAMAV_HOST=127.0.0.1\n'
424427
printf 'CLAMAV_PORT=3310\n\n'
425428
emit_secret VIRUSTOTAL_API_KEY "$VIRUSTOTAL_API_KEY"
429+
printf '\n'
430+
# WebDAV mount label (Finder/Cyberduck/GNOME honour it). Matches the friendly nginx path below.
431+
printf 'WEBDAV_NAME=%s\n' "$DAV_NAME"
426432
} > .env
427433
umask 022
428434
ok ".env written (mode 600). Keep MASTER_KEY safe — losing it loses all server-side files."
@@ -440,6 +446,9 @@ if $SETUP_NGINX; then
440446
say ""; info "Step 7 / 8 — Configuring nginx"
441447
need_sudo
442448
NGINX_CONF="/etc/nginx/sites-available/opencoperlock.conf"
449+
# $DAV_NAME (set near the top) is exposed as a friendly WebDAV path so the Windows network drive
450+
# shows as "$DAV_NAME" (Explorer labels the drive from the URL's last segment, not the server's
451+
# advertised name). The default /dav (or /api/dav) mount keeps working too.
443452
# Larger client_max_body_size so big uploads aren't rejected by the proxy.
444453
if [[ "$TOPO" == 1 ]]; then
445454
$SUDO tee "$NGINX_CONF" >/dev/null <<NGINX
@@ -460,6 +469,19 @@ server {
460469
server_name ${API_DOMAIN};
461470
client_max_body_size 0;
462471
proxy_request_buffering off;
472+
# Friendly WebDAV mount: https://${API_DOMAIN}/${DAV_NAME}/ → drive labelled "${DAV_NAME}".
473+
location /${DAV_NAME}/ {
474+
proxy_pass http://127.0.0.1:${API_PORT}/dav/;
475+
proxy_set_header Host \$host;
476+
proxy_set_header X-Real-IP \$remote_addr;
477+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
478+
proxy_set_header X-Forwarded-Proto \$scheme;
479+
proxy_set_header X-Forwarded-Prefix /${DAV_NAME};
480+
proxy_set_header Authorization \$http_authorization;
481+
proxy_pass_request_headers on;
482+
proxy_buffering off;
483+
proxy_read_timeout 3600s;
484+
}
463485
location / {
464486
proxy_pass http://127.0.0.1:${API_PORT};
465487
proxy_set_header Host \$host;
@@ -475,6 +497,21 @@ server {
475497
listen 80;
476498
server_name ${WEB_DOMAIN};
477499
client_max_body_size 0;
500+
# Friendly WebDAV mount: https://${WEB_DOMAIN}/${DAV_NAME}/ → drive labelled "${DAV_NAME}" on
501+
# Windows. (WebDAV also stays reachable at /api/dav/ via the /api/ block below.)
502+
location /${DAV_NAME}/ {
503+
proxy_pass http://127.0.0.1:${API_PORT}/dav/;
504+
proxy_request_buffering off;
505+
proxy_buffering off;
506+
proxy_read_timeout 3600s;
507+
proxy_set_header Host \$host;
508+
proxy_set_header X-Real-IP \$remote_addr;
509+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
510+
proxy_set_header X-Forwarded-Proto \$scheme;
511+
proxy_set_header X-Forwarded-Prefix /${DAV_NAME};
512+
proxy_set_header Authorization \$http_authorization;
513+
proxy_pass_request_headers on;
514+
}
478515
location /api/ {
479516
proxy_pass http://127.0.0.1:${API_PORT}/;
480517
proxy_request_buffering off;

0 commit comments

Comments
 (0)