kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Peer storage proxy sends the local URL_PATH_PREFIX to the peer

Open rtibblesbot opened this issue 1 week ago • 2 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: develop

Observed behavior

  • DynamicWhiteNoise builds a peer file's URL by joining ?baseurl=<peer> with the whole local request path (kolibri_whitenoise.py:655).
  • That path starts with the local URL_PATH_PREFIX, because the content directory is mounted under it (wsgi.py:30-32).
  • With URL_PATH_PREFIX = /school/, get_streaming_static_file returns these remote_url values for /school/content/storage/a/b/<file>:
Peer Requested from the peer Peer serves the file at
http://peer.example:8080/ http://peer.example:8080/school/content/storage/a/b/<file> http://peer.example:8080/content/storage/a/b/<file>
http://peer.example:8080/school/ http://peer.example:8080/school/school/content/storage/a/b/<file> http://peer.example:8080/school/content/storage/a/b/<file>

Expected behavior

The peer is asked for <peer>content/storage/a/b/<file>, the URL get_content_storage_remote_url builds for the zipcontent route.

User-facing consequences

On a Kolibri served under a path prefix, every file opened from another device's library returns 404: videos, audio, documents, and the H5P and Bloom archives.

Steps to reproduce

  1. Set URL_PATH_PREFIX = /school/ under [Deployment] in options.ini and start Kolibri.
  2. In Learn > Library, open another device's library and open a video that is not imported locally.
  3. In the network tab, /school/content/storage/…?baseurl=<peer> returns 404.

Context

  • Kolibri develop at 758605b764 and release-v0.20.x at b19ef0f009.

Acceptance Criteria

  • [ ] With URL_PATH_PREFIX = /school/, a request for /school/content/storage/a/b/<file>?baseurl=<peer> fetches <peer>content/storage/a/b/<file>, for a peer with a path prefix and one without.
  • [ ] The alternate origin server does the same under ZIP_CONTENT_URL_PATH_PREFIX.
  • [ ] A test in kolibri/utils/tests/test_kolibri_whitenoise.py requests a peer file through a prefixed mount.

AI usage

Claude Code found this while reviewing #15970, ran get_streaming_static_file for the four prefix combinations to get the table, and drafted the issue.

rtibblesbot avatar Nov 25 '26 12:11 rtibblesbot

/assign

ArpitaSamanta10 avatar Nov 25 '26 13:11 ArpitaSamanta10

Hi! 👋

Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.

We really appreciate your willingness to help. 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Nov 25 '26 13:11 learning-equality-bot