librespeed / librespeed/speedtest-cli
Server list from remote self hosted frontend
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 845
- Forks
- 90
- Avg merge
- 11d 22h
- Merged PRs (30d)
- 3
Description
Hi guys
I've setup a Librespeed frontend with a few backends, configured in the /servers.json file on the frontend server
The frontend is accessed via it's fqdn and works fine, tests are successful against the backend.
When attempting to run librespeed-cli --server-json http://speedtest.redacted/, the command fails with
Retrieving server list from http://speedtest.redacted/
Retry with /.well-known/librespeed
Error when fetching server list: invalid character '<' looking for beginning of value
Terminated due to error
I can see in the reverse proxy logs that both requests to / and /.well-known/librespeed are made, first one returns the frontend html, second one fails as the frontend is not configured to serve this path.
It looks like I am expected to host a copy of the servers.json file somewhere for the CLI to use - this is very illogical as the frontend accesses this same list as well; however, it seems to be rendered in the backend in php and provided in the HTML as a variable.
It would have been more practical to serve the list of servers at /.well-known/librespeed, which would be then accessed by both frontend via an ajax call and cli.
Am I misunderstanding/missing something?
I was experimenting with the idea of copying the servers.json from /servers.json to /var/www/html/servers.json by executing the command upon startup of the frontend pod before executing the /entrypoint.sh but it seems that the entrypoint wipes /var/www/html/ during start-up, rendering this workaround a no-go.
The CLI requests the list from https://librespeed.org/backend-servers/servers.php if not provided, the same file servers.php does not exist in librespeed, if it did, it could provide the JSON list; however, the CLI code would still have to be updated to look up /servers.php followed by /.well-known/librespeed if server-json is specified and does not contain a forward slash, if it does, the entire user provided value should be used to allow users to provide a full path to the file.
If those changes were made to librespeed source and propagated to librespeed.org, the default value for serverListUrl in the CLI could be set to simply https://librespeed.org, and the probing would automatically query https://librespeed.org/servers.php
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the CLI's server-list retrieval and default serverListUrl handling, then trace how it probes the root URL and /.well-known/librespeed. Compare those requests with the frontend's servers.json and the proposed servers.php behavior; done means the CLI can discover a self-hosted server list without returning HTML as JSON.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, php
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100