WebDAV error when renaming files

1. The problem I’m having:

I am using Caddy (MyQNAP package) as reverse proxy for my services and I use WebDAV to access my Keepass file in Keepass2Android app. The app can fetch the file just fine but saving changes is not possible. I believe it’s because the app first saves it as temporary file and then renames it to overwrite the original file. When I use WinSCP to check functionality of WebDAV I get “502 Bad Gateway” error when I try to rename the file. Any other operation works fine. I believe the issue is related to: https://serverfault.com/questions/121766/webdav-rename-fails-on-an-apache-mod-dav-install-behind-nginx or 502 Bad Gateway error on WebDav when syncing or renaming files - #3 by kkettinger - Seafile Server - Seafile Community Forum but I struggle to figure out how to implement suggested solutions in Caddy…

2. Error messages and/or full log output:

Only “502 Bad Gateway” when i try to rename a file via WebDAV in WinSCP.

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

3. Caddy version:

Caddy from MyQNAP v2.11.1.0

4. How I installed and ran Caddy:

QNAP package from MyQNAP

a. System environment:

b. Command:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

webdav.wildnerovi.cz {
encode zstd gzip
reverse_proxy localhost:5000
}

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources: