Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: pathPrefix or any host path is ignored #167

Open
kind3r opened this issue Mar 23, 2024 · 0 comments
Open

Bug: pathPrefix or any host path is ignored #167

kind3r opened this issue Mar 23, 2024 · 0 comments

Comments

@kind3r
Copy link

kind3r commented Mar 23, 2024

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant