enhancement: auto-prepend http:// scheme to http_proxy config for httpx compatibility
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- backend, networking
Research direction
Start in core_lifecycle.py and inspect where the http_proxy configuration is assigned to the environment. Verify the handling against both scheme-less values such as 127.0.0.1:7890 and existing values with a scheme; done means httpx-compatible proxy configuration without changing already valid setups.
Written by the indexing model from the issue text.
Description
enhancement: auto-prepend http:// scheme to http_proxy config for httpx compatibility
Background
AstrBot supports configuring an HTTP proxy via the http_proxy field in cmd_config.json. The value is then set as an environment variable in core_lifecycle.py:
os.environ["http_proxy"] = proxy_config
This value is consumed by various libraries, notably httpx (which is used internally by the OpenAI SDK and many AstrBot provider modules).
Problem
When a user configures the proxy without a URL scheme (e.g., 127.0.0.1:7890 instead of http://127.0.0.1:7890), the following issues arise:
- ✅ curl and the requests library handle this gracefully
- ❌ httpx throws
ValueError: Unknown scheme for proxy URL, breaking all httpx-dependent features (Whisper STT, TTS, OpenAI API calls, etc.)
This creates an inconsistent user experience, as the same proxy value works with some tools but silently breaks others.
Current state
The WebUI config schema does include a hint explaining the expected format (http://127.0.0.1:7890). However:
- Users who edit
cmd_config.jsondirectly never see this hint - There is no code-level validation or defensive handling in
core_lifecycle.py - The error message (
ValueError: Unknown scheme for proxy URL) is opaque to non-technical users
Suggested fix
In core_lifecycle.py, before setting the proxy environment variables, add a simple scheme auto-completion:
if "://" not in proxy_config:
proxy_config = "http://" + proxy_config
This is a minimal, zero-side-effect change that makes the configuration more robust without breaking existing setups.
Additional context
- AstrBot version: 4.25.1+
- OS: Linux
- No existing issues found on this topic
- The fix has been tested locally and works as expected
- Dominant language
- Python
- Stars
- 40.7k
- Forks
- 2.9k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 112
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AstrBotDevs/AstrBot
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AstrBotDevs/AstrBot#10033 · 3 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
AstrBotDevs/AstrBot#9999 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AstrBotDevs/AstrBot#9945 · 2 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AstrBotDevs/AstrBot#9938 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AstrBotDevs/AstrBot#9929 · 2 comments ·
All issues in AstrBotDevs/AstrBot
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100