Peer storage proxy sends the local URL_PATH_PREFIX to the peer
❌ 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
DynamicWhiteNoisebuilds 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_filereturns theseremote_urlvalues 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> |
- The alternate origin server mounts the same class under
ZIP_CONTENT_URL_PATH_PREFIX(alt_wsgi.py:26-28). - release-v0.20.x has the same join at
kolibri_whitenoise.py:473.
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
- Set
URL_PATH_PREFIX = /school/under[Deployment]inoptions.iniand start Kolibri. - In Learn > Library, open another device's library and open a video that is not imported locally.
- 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.pyrequests 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.
/assign
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.