pydantic / pydantic/httpx2

httpx ignores no_proxy and https_proxy in docker-compose

Open
#758 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
76
Avg merge
8h 59m
Merged PRs (30d)
24

Description

Originally opened by @lsch0lz on 2023-05-19 09:02:03 in encode/httpx

When I use httpx inside a Docker container that was built with the http_proxy and http_proxy environment variables, I cannot ignore these variables when starting the container via docker-compose.
I set the no_proxy variable when starting the container so that the container should ignore any proxies it was built with.
httpx still uses those proxies. To solve this I had to set trust_env=False in my AsyncClient.

Is this expected behaviour? I thought that disabling the proxies in the docker-compose file would automatically tell httpx to ignore them when making a request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the proxy behavior in Docker Compose with http_proxy, https_proxy, and no_proxy, comparing it with AsyncClient using trust_env=False. Trace how the environment is interpreted during a request; done means no_proxy causes matching destinations to bypass the configured proxies.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.