[GH-ISSUE #5367] [BUG]: Docker container ignores HTTP_PROXY/HTTPS_PROXY environment variables for LLM endpoints #5046

Closed
opened 2026-06-05 14:51:43 -04:00 by yindo · 2 comments
Owner

Originally created by @pablobots on GitHub (Apr 6, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5367

How are you running AnythingLLM?

Docker (local)

What happened?

I am deploying AnythingLLM via Docker in a corporate network environment. To reach external or internal LLM endpoints (e.g., OpenAI, Azure, or a remote Ollama instance), the container must go through an outbound proxy. Despite setting the standard environment variables, the application fails to connect.

The application seems to ignore HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables. When trying to configure an LLM provider, I get a "Connection Error" or "Fetch Failed" because the traffic is not being routed through the specified proxy.

Are there known steps to reproduce?

No response

LLM Provider & Model (if applicable)

No response

Embedder Provider & Model (if applicable)

No response

Originally created by @pablobots on GitHub (Apr 6, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5367 ### How are you running AnythingLLM? Docker (local) ### What happened? I am deploying AnythingLLM via Docker in a corporate network environment. To reach external or internal LLM endpoints (e.g., OpenAI, Azure, or a remote Ollama instance), the container must go through an outbound proxy. Despite setting the standard environment variables, the application fails to connect. The application seems to ignore HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables. When trying to configure an LLM provider, I get a "Connection Error" or "Fetch Failed" because the traffic is not being routed through the specified proxy. ### Are there known steps to reproduce? _No response_ ### LLM Provider & Model (if applicable) _No response_ ### Embedder Provider & Model (if applicable) _No response_
yindo added the possible bug label 2026-06-05 14:51:43 -04:00
yindo closed this issue 2026-06-05 14:51:43 -04:00
Author
Owner

@fdefilippo commented on GitHub (Apr 30, 2026):

I encountered the same proxy issue and solved it by using a redsocks sidecar that forces traffic through the proxy.
Even though I configured HTTP_PROXY and HTTPS_PROXY, AnythingLLM simply ignored them. The sidecar approach works at the network level and doesn't require any changes to the application.

Here's how it works: the sidecar container https://github.com/Pugemon/docker-proxy-sidecar shares the network stack of the AnythingLLM container via network_mode: "service:proxy_sidecar", allowing it to see all of its outgoing traffic. When the sidecar starts up, it automatically injects iptables rules to redirect all TCP traffic to redsocks, which then forwards it to your corporate proxy, handling protocol translation to HTTP or SOCKS5.

services:
  anythingllm:
    image: mintplexlabs/anythingllm
    container_name: anythingllm
    network_mode: "service:proxy_sidecar"   # shares network with sidecar
    depends_on:
      - proxy_sidecar
    volumes:
      - anythingllm_storage:/app/server/storage
    environment:
      - "UID=${UID:-1000}"
      - "GID=${GID:-1000}"

  proxy_sidecar:
    image: pugemon/proxy-sidecar:latest
    container_name: proxy_sidecar
    cap_add:
      - NET_ADMIN                         # required for iptables
    environment:
      - PROXY_HOST=your-proxy-host.com
      - PROXY_PORT=3128
      - PROXY_TYPE=http-connect
      # - PROXY_USER=username               # if authentication is required
      # - PROXY_PASS=password               # if authentication is required
      # - EXCLUDE_CIDR=172.20.0.0/16        # optional: CIDR ranges to bypass the proxy

volumes:
  anythingllm_storage:

You can find more details in the https://github.com/Pugemon/docker-proxy-sidecar repository. I recommend building the image from source to ensure you have the latest version.

The key advantage of this approach is that it works at the network level, so AnythingLLM doesn't need to be aware of the proxy at all.

<!-- gh-comment-id:4350681076 --> @fdefilippo commented on GitHub (Apr 30, 2026): I encountered the same proxy issue and solved it by using a redsocks sidecar that forces traffic through the proxy. Even though I configured HTTP_PROXY and HTTPS_PROXY, AnythingLLM simply ignored them. The sidecar approach works at the network level and doesn't require any changes to the application. Here's how it works: the sidecar container https://github.com/Pugemon/docker-proxy-sidecar shares the network stack of the AnythingLLM container via network_mode: "service:proxy_sidecar", allowing it to see all of its outgoing traffic. When the sidecar starts up, it automatically injects iptables rules to redirect all TCP traffic to redsocks, which then forwards it to your corporate proxy, handling protocol translation to HTTP or SOCKS5. ``` services: anythingllm: image: mintplexlabs/anythingllm container_name: anythingllm network_mode: "service:proxy_sidecar" # shares network with sidecar depends_on: - proxy_sidecar volumes: - anythingllm_storage:/app/server/storage environment: - "UID=${UID:-1000}" - "GID=${GID:-1000}" proxy_sidecar: image: pugemon/proxy-sidecar:latest container_name: proxy_sidecar cap_add: - NET_ADMIN # required for iptables environment: - PROXY_HOST=your-proxy-host.com - PROXY_PORT=3128 - PROXY_TYPE=http-connect # - PROXY_USER=username # if authentication is required # - PROXY_PASS=password # if authentication is required # - EXCLUDE_CIDR=172.20.0.0/16 # optional: CIDR ranges to bypass the proxy volumes: anythingllm_storage: ``` You can find more details in the https://github.com/Pugemon/docker-proxy-sidecar repository. I recommend building the image from source to ensure you have the latest version. The key advantage of this approach is that it works at the network level, so AnythingLLM doesn't need to be aware of the proxy at all.
Author
Owner

@timothycarambat commented on GitHub (May 1, 2026):

@fdefilippo This is a great solution, we dont even want to write code around this anyway because its a rabbit hole that will waste a ton of our time due to the litany of possible combinations someone could fix themselves doing for proxies.

Good idea for this, will just recommend this now/

<!-- gh-comment-id:4361141865 --> @timothycarambat commented on GitHub (May 1, 2026): @fdefilippo This is a great solution, we dont even want to write code around this anyway because its a rabbit hole that will waste a ton of our time due to the litany of possible combinations someone could fix themselves doing for proxies. Good idea for this, will just recommend this now/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5046