Skip to content

Location-based reverse proxying breaks uploading to shares (and other things) #168

@intelfx

Description

@intelfx

Describe the bug

Using path-based reverse proxying (i.e., --rp-loc) causes multiple issues and specifically breaks uploading into link-shared folders:

  1. Paths in the file tree browser are prepended with the location prefix (e.g., /copy/ if --rp-loc=/copy).
  2. When adding a share, the share source path is prepended with the location prefix again.
  3. When trying to upload to a share, the target path still contains the location prefix.
  4. Any actual attempt to upload a file into a share ends up with a share-mapping failed error:
    copyparty[2023898]: 17:27:38.414 100.64.141.24 6       POST /copy/shares/kr4niq164hot/ @*
    copyparty[2023898]: 17:27:38.414 100.64.141.24 6       POST len=646 type=utf-8 ip=100.64.141.24 user=* req='/copy/shares/kr4niq164hot/' json={'name': 'sr-tcgrfs18.zip', 'size': 12178088, 'lmod': 1746794594.565, 'life': 0, 'hash': '12 chunks'}
    copyparty[2023898]: 17:27:38.415 100.64.141.24 6       http500: share-mapping failed; req='shares/kr4niq164hot' dbv='files' vrem='shared' n1='/shares/kr4niq164hot/' n2='/files/shared/' purl='/copy/files/shared/', '/shares/kr4niq164hot'
    

To Reproduce

/etc/copyparty.d/main.conf
# not actually YAML but lets pretend:
# -*- mode: yaml -*-
# vim: ft=yaml:

[global]
  j: 0

  i: unix:777:/run/copyparty/copyparty.sock
  http-only
  rp-loc: /copy

  shr: /shares
  shr-db: ./shares.db # relative to cwd, /var/lib/copyparty
  shr-adm: foo
  use-fpool
  u2j: 4
  u2abort: 3

  e2d
  hist: ./hist # relative to cwd, /var/lib/copyparty
  dbpath: ./db # relative to cwd, /var/lib/copyparty

[accounts]
  foo: bar

[/public]
  /path/to/public
  accs:
    r: *
    rw: foo

[/files]
  /path/to/files
  accs:
    rw: foo

# same for /media, /torrents

Expected behavior

When location-based reverse-proxying is used, the location prefix is correctly stripped out from all elements of the UI and uploading to shares is usable.

Screenshots

  1. Paths in the file tree browser are prepended with the location prefix:
    Image
  2. When adding a share, the share source path is prepended with the location prefix:
    Image
  3. When trying to upload to a share, the target path still contains the location prefix:
    Image
  4. Eventually, the upload fails:
    Image

Server details (if you're NOT using docker/podman)

  • server OS / version: 1.17.1

  • what copyparty did you grab: Arch

  • how you're running it: systemd service

  • run copyparty with --version:

    copyparty v1.17.1 "mixtape.m3u" (2025-05-18)
      CPython v3.13.3 on Linux64  [GCC 14.2.1 20250207]
       sqlite 3.49.2*1 | jinja 3.1.5 | pyftpd (None) | tftp (None)
    
  • copyparty arguments and/or config-file: see above

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions