You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I bet this is not the intended usage, I've come to like libsql for the ability to be hosted (through a proxy of some sorts) on a single subdomain because the clients happily accept a path in the URL. However, this client in particular splits off the last segment, which all others dont. For example, libsql://example.com/some/sub/path causes the proxy to recieve a request at https://example.com/some/sub (or well, a subpath of said url, so https://example.com/some/sub/v2/pipeline or alike).
The other clients don't seem to do this, so I'm just gonna claim it is a bug in this client and not a result of me messing with something proabably not even intended :)
Root cause: encodeBaseUrl produced a base URL with no trailing slash on the path, and the Hrana client resolves each endpoint with new URL("v2/pipeline", baseUrl). Per the WHATWG URL resolver, a base whose path doesn't end in / has its last segment replaced — so libsql://host/some/sub/path sent requests to https://host/some/sub/v2/pipeline. That's also why the trailing-/ workaround worked. The PR adds the trailing slash in encodeBaseUrl (root paths unchanged) with a regression test.
Activity
tizu69 commentedon Feb 3, 2025
as a temporary solution, appending a
/to the url so that it has a trailing slash seems to work just fine.OsamaAnsar commentedon Sep 4, 2026
Opened #356 for this.
Root cause:
encodeBaseUrlproduced a base URL with no trailing slash on the path, and the Hrana client resolves each endpoint withnew URL("v2/pipeline", baseUrl). Per the WHATWG URL resolver, a base whose path doesn't end in/has its last segment replaced — solibsql://host/some/sub/pathsent requests tohttps://host/some/sub/v2/pipeline. That's also why the trailing-/workaround worked. The PR adds the trailing slash inencodeBaseUrl(root paths unchanged) with a regression test.