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

Request: respect https_proxy and http_proxy env variables for network requests #518

Open
wanliqun opened this issue Nov 30, 2024 · 1 comment

Comments

@wanliqun
Copy link

wanliqun commented Nov 30, 2024

Description

I encountered an issue where exo does not respect the https_proxy and http_proxy environment variables for network requests, even though the system environment is properly configured.

The root cause appears to be the way aiohttp is used in the exo codebase. aiohttp supports proxy usage via environment variables through setting trust_env=True for aiohttp.ClientSession . However, it seems the current implementation in exo does not leverage this feature.

This limitation prevents users from routing traffic through a proxy, which is critical in certain network setups such as corporate environments or restricted networks.

Steps to Reproduce

  1. Set up proxy environment variables:
   export http_proxy=http://proxy-server:port
   export https_proxy=http://proxy-server:port
  1. Run exo with a command that makes network requests (e.g., model downloading).
  2. Observe that the requests do not route through the specified proxy, and connections fail in environments where direct access is blocked.

Expected Behavior

exo should honor the http_proxy, https_proxy, and no_proxy environment variables automatically when making network requests.

Actual Behavior

exo fails to use the proxy settings, resulting in connection errors in proxied environments.

Proposed Solution

Update the aiohttp usage in exo to automatically respect environment proxy settings. This can be achieved by ensuring that trust_env=True is explicitly passed to aiohttp.ClientSession() like this:

async with aiohttp.ClientSession(trust_env=True) as session:
        async with session.get(url) as response:
            print(await response.text())

Environment

exo version: latest main branch
aiohttp version: aiohttp-3.10.11
Operating System: windows11+wsl(ubuntu 20.04)
Python Version: 3.12

@wanliqun
Copy link
Author

As seen in PR #519

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