Skip to content

Bug: pathPrefix or any host path is ignored #167

@kind3r

Description

@kind3r

With the current way the address is resolved, all API calls that start with a / will be resolved to the root of the host, completely ignoring any path that was specified and also pathPrefix option.

To give an example, a Portainer base path would be https://portainer.example.com/api/endpoints/1/docker/.
The call to list containers uses /containers/json as API path so the resolved request path becomes https://portainer.example.com/containers/json which is incorrect.
It should instead be https://portainer.example.com/api/endpoints/1/docker/containers/json.

A simple fix would be to strip the leading slash of the API path call:

address = url.resolve(address, options.path.startsWith('/') ? options.path.substring(1) : options.path);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions