Skip to content

Use path_prefix to compute base_url in httpx #243

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vruello
Copy link

@vruello vruello commented Apr 17, 2025

Currently, the path_prefix configuration (i.e. the url path) of the ES host is removed by the httpx client. This PR adds it.

path_prefix is set by client_utils.url_to_node_config (https://github.com/elastic/elastic-transport-python/blob/main/elastic_transport/client_utils.py#L187). It is either "" if the url path is empty or "/", or the url path itself.

For example, if you configure host to be http://localhost:9092/test and run a search() query, you'll see an HTTP request sent to http://localhost:9092/_search, without the "test" prefix.

This is very useful when elastic endpoints are behind a reverse proxy with a specific path.

Copy link

cla-checker-service bot commented Apr 17, 2025

💚 CLA has been signed

@pquentin
Copy link
Member

Thank you! Can you please sign the CLA?

@vruello
Copy link
Author

vruello commented Apr 30, 2025

Hi! Sorry for the delay. I just signed the CLA.

@vruello
Copy link
Author

vruello commented Apr 30, 2025

By the way, do you think this commit could be backported to 8.x?

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

Successfully merging this pull request may close these issues.

2 participants