Skip to content

client strips last url path segment #296

Open

Description

@tizu69

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 :)

Activity

  1. tizu69 commented on Feb 3, 2025

    @tizu69
    Author

    as a temporary solution, appending a / to the url so that it has a trailing slash seems to work just fine.

  2. OsamaAnsar commented on Sep 4, 2026

    @OsamaAnsar

    Opened #356 for this.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions