Cloudflare workers proxy for ListenBrainz API.
If you are sharing your public IP with malicious bots, your IP can get automatically blocked.
Metabrainz support team can unblock it upon your request but in the meantime you are going to lose your scrobbles.
To keep your scrobbling uninterrupted you can set up a proxy.
HTTP proxies are often paid or require you to rent a VPS. Free proxies are often unreliable.
Cloudflare workers are free.
This repo contains a js script that can be used on your cloudflare worker as a proxy to ListenBrainz API.
Thus you can keep scrobbling even when LB website is inaccessible for you.
- Open the Cloudflare dashboard
- Go to the
Compute > Workers & Pages - Create a new Hello World worker application
- Copy-paste
lb-proxy.jscontent into code editor - Save the worker and rename it into something meaningful, like
lb-proxy - Generate a SHA-256 hash of your ListenBrainz token.
- macOS example:
sha256 -s '00000000-0000-0000-0000-000000000000' - Debian example:
echo -ne '00000000-0000-0000-0000-000000000000' | sha256sum
- macOS example:
- Open worker's
Settings > Variables and Secretsand create a variable namedLB_TOKEN_HASHcontaining the hash from the previous step
Note the Domains and routes section in the Settings. You can see there a workers.dev domain, something like lb-proxy.yourusername.workers.dev. You can use that domain as a replacement for api.listenbrainz.org in your music application.
Option A. Put ListenBrainz.BaseURL=https://lb-proxy.yourusername.workers.dev/1/ into your navidrome.toml. Replace lb-proxy.yourusername.workers.dev with your actual worker's domain. Restart Navidrome.
Option B. Stop Navidrome. Restart it with environment variable ND_LISTENBRAINZ_BASEURL=https://lb-proxy.yourusername.workers.dev/1/. Replace lb-proxy.yourusername.workers.dev with your actual worker's domain.
My own example with docker compose
For more details on configuration refer to Navidrome docs.