diff --git a/docs/troubleshooting/webdav-copyparty.md b/docs/troubleshooting/webdav-copyparty.md index e1dcab4..7dd4969 100644 --- a/docs/troubleshooting/webdav-copyparty.md +++ b/docs/troubleshooting/webdav-copyparty.md @@ -39,6 +39,27 @@ server { - Error: `HTTP/1.1 403 Forbidden` **Solution**: Add `d` (delete) permission to user accounts: + +### 3. URL Encoding Issues +**Problem**: Files/folders with spaces or special characters in names caused HTTP 400 errors. + +**Symptoms**: +- Files without spaces upload successfully +- Files with spaces in path fail: `HTTP/1.1 400 Bad Request` +- Logs show "bad headers" errors from copyparty +- URLs like `/files/folder/file%20name.txt` fail + +**Solution**: Pass original request URI to preserve URL encoding: +```nginx +location ~ ^/files(/.*)?$ { + # Pass original request URI to preserve URL encoding + proxy_pass http://127.0.0.1:8082; + # ... other proxy settings +} +``` + +Instead of `proxy_pass http://127.0.0.1:8082/files$1;` which manipulates the path. + ```ini [/shared] /home/hoborg/shared @@ -115,7 +136,8 @@ server { # Explicitly allow WebDAV methods limit_except GET POST PUT DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK { deny all; } - proxy_pass http://127.0.0.1:8082/files$1; + # Pass original request URI to preserve URL encoding + proxy_pass http://127.0.0.1:8082; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -140,6 +162,10 @@ server { # Critical: Streaming uploads for WebDAV proxy_buffering off; proxy_request_buffering off; + + # Critical: Use HTTP/1.1 and fix connection headers + proxy_http_version 1.1; + proxy_set_header Connection ""; # Critical: Disable nginx response modifications proxy_redirect off;