Skip to content

Opencode not respecting NO_PROXY variable #8822

Closed

Description

@anand2312

Description

Running behind a corporate proxy, I have set the HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables as described here

HTTP_PROXY=http://proxy.org.com
HTTPS_PROXY=http://proxy.org.com
NO_PROXY=*.org.com,localhost,127.0.0.1

I need the proxy variables set so that the global npm registry is accessible to install opencode's necessary plugins from, BUT I need opencode to connect to a local LiteLLM proxy as the LLM provider, running on (say) litellm.org.com:4000. My org requires that internal traffic should not be sent through the proxy, which is why I have *.org.com in my NO_PROXY. This setup works for every other application I use (including claude code)

Opencode seems to be routing the requests to LiteLLM also through the proxy, the log files include the error message that my org's proxy returns when you try reaching some internal endpoint through it.
Removing the HTTP_PROXY/HTTPS_PROXY in turn ends up working, but is just a band-aid fix

Plugins

No response

OpenCode version

1.1.23

Steps to reproduce

No response

Screenshot and/or share link

2026-01-16T063149.log

log including the error from my proxy server

Proxy variables set:

PS C:\Users\user> Get-ChildItem Env:*_PROXY

Name                           Value
----                           -----
NO_PROXY                       *.org.com,localhost,127.0.0.1
HTTPS_PROXY                    http://proxy.org.com:80
ALL_PROXY                      http://proxy.org.com:80
HTTP_PROXY                    http://proxy.org.com:80

Operating System

Windows 11

Terminal

Windows Terminal, Alacritty

Activity

  1. github-actions commented on Jan 16, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The key difference in your issue (#8822) is the specific handling of the NO_PROXY environment variable for selective routing, which appears to be not respected even though standard tools handle it correctly.

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Jan 26, 2026

    @rekram1-node
    Collaborator

    Think this is probably a bun bug, ur using the tui right?

  3. Thesam1798 commented on Jan 27, 2026

    @Thesam1798

    Fix available in PR #10856

    This issue is addressed by PR #10856 which implements proper NO_PROXY pattern matching.

    Your use case:

    NO_PROXY=*.org.com,localhost,127.0.0.1
    

    Our implementation supports:

    • ✅ Wildcard patterns: *.org.com matches litellm.org.com
    • ✅ Suffix patterns: .org.com matches any subdomain
    • ✅ Exact match: localhost, 127.0.0.1
    • ✅ Domain suffix: org.com also matches sub.org.com

    The fix is in packages/opencode/src/util/fetch.ts - we implement our own proxyFetch() wrapper that properly handles NO_PROXY patterns, rather than relying on Bun's native handling.

    Note: This is independent of Bun's proxy handling - we explicitly parse and match NO_PROXY patterns before deciding whether to use the proxy.

  4. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions