[GH-ISSUE #1105] [Feature Request]: Support VPN proxy settings. #302

Open
opened 2026-10-31 22:11:20 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @comfyui-wiki on GitHub (Apr 21, 2025).
Original GitHub issue: https://github.com/Comfy-Org/desktop/issues/1105

Prerequisites

  • I have searched the existing issues and checked the recent builds/commits
  • I have read the documentation and this feature is not already available
  • This is a single feature request (not multiple features combined)

Problem Statement

It seems that ComfyUI still doesn't support VPN proxy settings right now.

I have searched the issues and found that previously there was one user in China who wanted this feature too #428. Then it was resolved by supporting the use of a custom torch pip mirror #473.

But I think the proxy setting still needs to be considered.

Here is why the proxy setting need been Supported for China users.

I just updated Desktop yesterday. But when the Desktop launched again, it showed that I need to install python packages again. But it still failed when I tried to install, maybe due to the network.

Image

Even when I set the VPN to Global mode, it still didn't succeed.

Some VPN don't work well

I have tried several VPN these year, but some just don't worked well.

I can access Github with them but when I tried to clone repo from Github, it failed.

Sometimes just need to switch the VPN to global mode or use http.proxy for terminal will.

But not all the user know that they will just confuse why it didn't worked.

With VPN proxy the ComfyUI Manager works better.

Sometimes the ComfyUI Manager just can't fetch data. My VPN is always active when I start my computer.

When ComfyUI Manager can‘t fetch data, I just need to switch the VPN to global mode, then switch to normal mode after that.

My previous VPN doesn't work well. Even in global mode, it still can't fetch data, so I changed it recently.

But when using the previous VPN with the distribution made by 秋葉 aaaki, everything just works perfectly.

Image

The mirrors are not always stable

I had tried to install the Desktop on several different devices for testing, but on some devices, the mirror settings don't work well.

I think that if the user can set up a VPN proxy at the beginning, even if the mirrors are not stable, the setup can run more smoothly.

I think set the VPN to global mode worked too, but I haven't try to test the Desktop install proccess again recently.

Proposed Solution

Support Proxy Settings

It would be better if the portable version supports it too.

Users in China really need that setting.

Potential workflow

Here is my demo.

1. Support proxy settings when install the Desktop

Image

2. Support proxy settings in the menu

It should be with the mirror setting I think but I can't start my desktop today.

Image

3. Support proxy settings in maintain mode

Maybe it need re-design in this part, maybe sometimes users just don't setup proxy before but they just encounter errors, so it will be help

Image

Impact Level

Critical (Blocking my work)

Alternatives Considered

No response

Additional information

For reference I uploaded 秋葉's distribution.
https://drive.google.com/file/d/1dGlL4IeQ6h9TAkboxDMA1Jw_NnrjWRkF/view?usp=drive_link

You can try the network settings under the setting section. It would be better to have hf's mirror setting too.

Sometimes just can't download the model in the terminal successfully.

Image

┆Issue is synchronized with this Notion page by Unito

Originally created by @comfyui-wiki on GitHub (Apr 21, 2025). Original GitHub issue: https://github.com/Comfy-Org/desktop/issues/1105 ### Prerequisites - [x] I have searched the existing issues and checked the recent builds/commits - [x] I have read the documentation and this feature is not already available - [x] This is a single feature request (not multiple features combined) ### Problem Statement It seems that ComfyUI still doesn't support VPN proxy settings right now. I have searched the issues and found that previously there was one user in China who wanted this feature too [#428](https://github.com/Comfy-Org/desktop/issues/428). Then it was resolved by supporting the use of a custom torch pip mirror [#473](https://github.com/Comfy-Org/desktop/pull/743). But I think the proxy setting still needs to be considered. ## Here is why the proxy setting need been Supported for China users. I just updated Desktop yesterday. But when the Desktop launched again, it showed that I need to install python packages again. But it still failed when I tried to install, maybe due to the network. ![Image](https://github.com/user-attachments/assets/802ec322-d75e-4c61-98fd-63b9b70e7edb) Even when I set the VPN to Global mode, it still didn't succeed. ### Some VPN don't work well I have tried several VPN these year, but some just don't worked well. I can access Github with them but when I tried to clone repo from Github, it failed. Sometimes just need to switch the VPN to global mode or use http.proxy for terminal will. But not all the user know that they will just confuse why it didn't worked. ### With VPN proxy the ComfyUI Manager works better. Sometimes the ComfyUI Manager just can't fetch data. My VPN is always active when I start my computer. When ComfyUI Manager can‘t fetch data, I just need to switch the VPN to global mode, then switch to normal mode after that. My previous VPN doesn't work well. Even in global mode, it still can't fetch data, so I changed it recently. But when using the previous VPN with the distribution made by [秋葉 aaaki](https://www.bilibili.com/video/BV1Ew411776J/), everything just works perfectly. ![Image](https://github.com/user-attachments/assets/703d6378-a1ba-4514-8128-5ec2ddc28bbf) ### The mirrors are not always stable I had tried to install the Desktop on several different devices for testing, but on some devices, the mirror settings don't work well. I think that if the user can set up a VPN proxy at the beginning, even if the mirrors are not stable, the setup can run more smoothly. I think set the VPN to global mode worked too, but I haven't try to test the Desktop install proccess again recently. ### Proposed Solution Support Proxy Settings It would be better if the portable version supports it too. Users in China really need that setting. ### Potential workflow Here is my demo. ## 1. Support proxy settings when install the Desktop ![Image](https://github.com/user-attachments/assets/579283bf-ff7a-49bb-9df6-0a1192b95194) ## 2. Support proxy settings in the menu It should be with the mirror setting I think but I can't start my desktop today. ![Image](https://github.com/user-attachments/assets/5760f523-6fdc-4df9-8a29-c36ceb88218a) ## 3. Support proxy settings in maintain mode Maybe it need re-design in this part, maybe sometimes users just don't setup proxy before but they just encounter errors, so it will be help ![Image](https://github.com/user-attachments/assets/8061f5e5-6abb-4e10-9976-6c85a14651b2) ### Impact Level Critical (Blocking my work) ### Alternatives Considered _No response_ ### Additional information For reference I uploaded 秋葉's distribution. https://drive.google.com/file/d/1dGlL4IeQ6h9TAkboxDMA1Jw_NnrjWRkF/view?usp=drive_link You can try the network settings under the setting section. It would be better to have hf's mirror setting too. Sometimes just can't download the model in the terminal successfully. ![Image](https://github.com/user-attachments/assets/11150877-13f3-4999-870b-ccfa41aa8607) ┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-1105-Feature-Request-Support-VPN-proxy-settings-1dc6d73d365081fa9a38c36c0c27fb35) by [Unito](https://www.unito.io)
Author
Owner

@orchie commented on GitHub (Aug 30, 2025):

4个月过去了,最新版依然没有代理设置选项...

<!-- gh-comment-id:3239278281 --> @orchie commented on GitHub (Aug 30, 2025): 4个月过去了,最新版依然没有代理设置选项...
Author
Owner

@dosubot[bot] commented on GitHub (Nov 29, 2025):

Hi, @comfyui-wiki. I'm Dosu, and I'm helping the desktop team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested VPN proxy support in ComfyUI to improve package installation and data fetching, especially for users in China.
  • You highlighted that some VPNs are incompatible with ComfyUI Manager and that proxy settings would help avoid switching VPN modes.
  • A community member noted that even after four months, the latest version still lacks proxy configuration options.
  • The issue remains unresolved with no updates or solutions provided so far.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of the desktop app by commenting here.
  • If I don’t hear back within 7 days, this issue will be automatically closed.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3591774076 --> @dosubot[bot] commented on GitHub (Nov 29, 2025): Hi, @comfyui-wiki. I'm [Dosu](https://dosu.dev), and I'm helping the desktop team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested VPN proxy support in ComfyUI to improve package installation and data fetching, especially for users in China. - You highlighted that some VPNs are incompatible with ComfyUI Manager and that proxy settings would help avoid switching VPN modes. - A community member noted that even after four months, the latest version still lacks proxy configuration options. - The issue remains unresolved with no updates or solutions provided so far. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of the desktop app by commenting here. - If I don’t hear back within 7 days, this issue will be automatically closed. Thank you for your understanding and contribution!
Author
Owner

@snomiao commented on GitHub (Mar 26, 2026):

Research: Implementing HTTP/HTTPS Proxy Settings for ComfyUI

This issue was closed by dosubot as stale, but the feature was never implemented. Mirrors (#573) only cover pip/Python install — they don't help with general outbound traffic (API calls, model downloads, git clones, custom node network requests, etc.). Reopening to track the actual proxy support.

  • Comfy-Org/desktop#428 — "Hope to add VPN proxy setting function" (closed stale)
  • Comfy-Org/desktop#450 — "Chinese users unable to use Git/HuggingFace/PyPI — add proxy" (closed → #573, only mirrors addressed)
  • Comfy-Org/ComfyUI#4499 — Pathname-based reverse proxy (different problem, but related to proxy UX)

The Problem

Users (especially in China) need ComfyUI to route all outbound HTTP/HTTPS traffic through a local proxy (e.g. http://127.0.0.1:7890) without changing system-wide proxy settings. Currently there is zero proxy configuration in either the Python backend or the Electron desktop app.

Proposed Approach: Environment Variables

The most robust strategy is setting standard HTTP_PROXY / HTTPS_PROXY / NO_PROXY environment variables early in process startup. This works universally because all major HTTP libraries respect these by default:

Library (used in ComfyUI) Respects env vars? Where used
aiohttp (trust_env=True default) ✅ API client, downloads, uploads (6 ClientSession sites)
requests ✅ Frontend management (GitHub API)
urllib ✅ k_diffusion file downloads
Subprocesses (git, pip, etc.) ✅ Inherits os.environ
Custom nodes (any HTTP lib) ✅ All standard libs check env vars

Implementation Plan

1. Python Backend (Comfy-Org/ComfyUI)

comfy/cli_args.py — Add CLI argument:

parser.add_argument("--http-proxy", type=str, default=None,
    help="HTTP/HTTPS proxy URL (e.g. http://127.0.0.1:7890). "
         "Sets HTTP_PROXY and HTTPS_PROXY environment variables.")
parser.add_argument("--no-proxy", type=str, default=None,
    help="Comma-separated hosts to bypass proxy (e.g. localhost,127.0.0.1)")

main.py — Set env vars early (around line 28, before heavy imports):

if args.http_proxy:
    for var in ('HTTP_PROXY', 'http_proxy', 'HTTPS_PROXY', 'https_proxy'):
        os.environ[var] = args.http_proxy
if args.no_proxy:
    for var in ('NO_PROXY', 'no_proxy'):
        os.environ[var] = args.no_proxy

This is the earliest safe point — after CLI args are parsed (line ~10) but before any heavy module imports (line ~34). All 6 aiohttp.ClientSession creations, all requests.get() calls, and all urllib usage will automatically route through the proxy with zero per-call changes.

2. Electron Desktop App (Comfy-Org/desktop)

Chromium/Electron side:

// Before app.ready — configure Electron's own network stack
app.commandLine.appendSwitch('proxy-server', proxyUrl);

Python process spawning:

  • Pass --http-proxy <url> when launching the ComfyUI Python server
  • Or set HTTP_PROXY/HTTPS_PROXY in the child process env

UI:

  • Add a proxy URL input field in Settings (next to existing mirror settings)
  • Optionally add proxy config to the install wizard for first-time setup
  • Persist the setting to config file so it survives restarts
  • Show a note that restart is required after changing proxy settings

3. Network Locations That Will Be Covered

All of these currently have zero proxy support and would be automatically covered by the env var approach:

File What it does
comfy_api_nodes/util/client.py (lines 482, 632) Main API client — all /proxy/* endpoint calls (OpenAI, Stability, BFL, Kling, etc.)
comfy_api_nodes/util/download_helpers.py (line 85) File/model downloads
comfy_api_nodes/util/upload_helpers.py (line 288) File uploads
server.py (line 1033) Server's own outbound ClientSession
app/frontend_management.py (lines 113, 126, 167) GitHub API calls for frontend releases
comfy/k_diffusion/utils.py (line 42) urllib downloads with hash validation
Any custom node Automatically inherits env vars
Subprocesses (git clone, pip install) Automatically inherits env vars

Why NOT Per-Session Proxy Config?

Patching each aiohttp.ClientSession() or requests.get() individually would:

  • Miss custom nodes entirely (they create their own sessions)
  • Require touching 6+ aiohttp sites + requests sites + urllib sites
  • Not affect subprocesses (git, pip)
  • Be fragile as new code is added

Setting env vars once covers everything automatically — including code that hasn't been written yet.

Next Steps

I'm happy to submit PRs for:

  1. ComfyUI backend: --http-proxy / --no-proxy CLI args + early env var setup in main.py
  2. Desktop app: UI settings + Electron proxy-server switch + passing args to Python process

Feedback welcome on the approach before I start coding.

<!-- gh-comment-id:4138648072 --> @snomiao commented on GitHub (Mar 26, 2026): ## Research: Implementing HTTP/HTTPS Proxy Settings for ComfyUI This issue was closed by dosubot as stale, but the feature was never implemented. Mirrors (#573) only cover pip/Python install — they don't help with general outbound traffic (API calls, model downloads, git clones, custom node network requests, etc.). Reopening to track the actual proxy support. ### Related Issues - Comfy-Org/desktop#428 — "Hope to add VPN proxy setting function" (closed stale) - Comfy-Org/desktop#450 — "Chinese users unable to use Git/HuggingFace/PyPI — add proxy" (closed → #573, only mirrors addressed) - Comfy-Org/ComfyUI#4499 — Pathname-based reverse proxy (different problem, but related to proxy UX) ### The Problem Users (especially in China) need ComfyUI to route **all** outbound HTTP/HTTPS traffic through a local proxy (e.g. `http://127.0.0.1:7890`) without changing system-wide proxy settings. Currently there is **zero** proxy configuration in either the Python backend or the Electron desktop app. ### Proposed Approach: Environment Variables The most robust strategy is setting standard `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY` environment variables **early in process startup**. This works universally because all major HTTP libraries respect these by default: | Library (used in ComfyUI) | Respects env vars? | Where used | |---|---|---| | **aiohttp** (`trust_env=True` default) | ✅ | API client, downloads, uploads (6 `ClientSession` sites) | | **requests** | ✅ | Frontend management (GitHub API) | | **urllib** | ✅ | k_diffusion file downloads | | **Subprocesses** (git, pip, etc.) | ✅ | Inherits `os.environ` | | **Custom nodes** (any HTTP lib) | ✅ | All standard libs check env vars | ### Implementation Plan #### 1. Python Backend (`Comfy-Org/ComfyUI`) **`comfy/cli_args.py`** — Add CLI argument: ```python parser.add_argument("--http-proxy", type=str, default=None, help="HTTP/HTTPS proxy URL (e.g. http://127.0.0.1:7890). " "Sets HTTP_PROXY and HTTPS_PROXY environment variables.") parser.add_argument("--no-proxy", type=str, default=None, help="Comma-separated hosts to bypass proxy (e.g. localhost,127.0.0.1)") ``` **`main.py`** — Set env vars early (around line 28, before heavy imports): ```python if args.http_proxy: for var in ('HTTP_PROXY', 'http_proxy', 'HTTPS_PROXY', 'https_proxy'): os.environ[var] = args.http_proxy if args.no_proxy: for var in ('NO_PROXY', 'no_proxy'): os.environ[var] = args.no_proxy ``` This is the **earliest safe point** — after CLI args are parsed (line ~10) but before any heavy module imports (line ~34). All 6 `aiohttp.ClientSession` creations, all `requests.get()` calls, and all `urllib` usage will automatically route through the proxy with zero per-call changes. #### 2. Electron Desktop App (`Comfy-Org/desktop`) **Chromium/Electron side:** ```js // Before app.ready — configure Electron's own network stack app.commandLine.appendSwitch('proxy-server', proxyUrl); ``` **Python process spawning:** - Pass `--http-proxy <url>` when launching the ComfyUI Python server - Or set `HTTP_PROXY`/`HTTPS_PROXY` in the child process env **UI:** - Add a proxy URL input field in Settings (next to existing mirror settings) - Optionally add proxy config to the install wizard for first-time setup - Persist the setting to config file so it survives restarts - Show a note that restart is required after changing proxy settings #### 3. Network Locations That Will Be Covered All of these currently have **zero** proxy support and would be automatically covered by the env var approach: | File | What it does | |---|---| | `comfy_api_nodes/util/client.py` (lines 482, 632) | Main API client — all `/proxy/*` endpoint calls (OpenAI, Stability, BFL, Kling, etc.) | | `comfy_api_nodes/util/download_helpers.py` (line 85) | File/model downloads | | `comfy_api_nodes/util/upload_helpers.py` (line 288) | File uploads | | `server.py` (line 1033) | Server's own outbound ClientSession | | `app/frontend_management.py` (lines 113, 126, 167) | GitHub API calls for frontend releases | | `comfy/k_diffusion/utils.py` (line 42) | urllib downloads with hash validation | | Any custom node | Automatically inherits env vars | | Subprocesses (git clone, pip install) | Automatically inherits env vars | ### Why NOT Per-Session Proxy Config? Patching each `aiohttp.ClientSession()` or `requests.get()` individually would: - Miss custom nodes entirely (they create their own sessions) - Require touching 6+ aiohttp sites + requests sites + urllib sites - Not affect subprocesses (git, pip) - Be fragile as new code is added Setting env vars once covers everything automatically — including code that hasn't been written yet. ### Next Steps I'm happy to submit PRs for: 1. **ComfyUI backend**: `--http-proxy` / `--no-proxy` CLI args + early env var setup in `main.py` 2. **Desktop app**: UI settings + Electron `proxy-server` switch + passing args to Python process Feedback welcome on the approach before I start coding.
Author
Owner

@snomiao commented on GitHub (Mar 27, 2026):

Draft PRs Submitted

Implementation is ready for review across all 3 repos:

Repo PR Changes
ComfyUI (Python backend) Comfy-Org/ComfyUI#13179 --http-proxy, --https-proxy, --no-proxy CLI args + env var setup in main.py
ComfyUI_frontend Comfy-Org/ComfyUI_frontend#10581 Settings UI under Comfy > Network (3 text fields)
desktop (Electron) Comfy-Org/desktop#1679 session.setProxy() for Chromium + process.env for child processes + server launch args

How it works

  1. User sets proxy URL in Settings > Comfy > Network (or via --http-proxy CLI arg)
  2. On restart, the setting is read from comfy.settings.json
  3. Environment variables HTTP_PROXY/HTTPS_PROXY/NO_PROXY are set before any network activity
  4. All HTTP libraries (aiohttp, requests, urllib) + subprocesses (git, pip, uv) automatically route through the proxy
  5. In the desktop app, Chromium's network stack is also configured via session.setProxy()

Usage

CLI (standalone):

python main.py --http-proxy http://127.0.0.1:7890

Desktop app: Set in Settings > Comfy > Network > "HTTP/HTTPS proxy URL", then restart.

This covers all 6 aiohttp.ClientSession sites, all requests.get() calls, urllib downloads, custom nodes, and subprocesses — without modifying any individual call site.

<!-- gh-comment-id:4139111667 --> @snomiao commented on GitHub (Mar 27, 2026): ## Draft PRs Submitted Implementation is ready for review across all 3 repos: | Repo | PR | Changes | |------|-----|---------| | **ComfyUI** (Python backend) | Comfy-Org/ComfyUI#13179 | `--http-proxy`, `--https-proxy`, `--no-proxy` CLI args + env var setup in `main.py` | | **ComfyUI_frontend** | Comfy-Org/ComfyUI_frontend#10581 | Settings UI under **Comfy > Network** (3 text fields) | | **desktop** (Electron) | Comfy-Org/desktop#1679 | `session.setProxy()` for Chromium + `process.env` for child processes + server launch args | ### How it works 1. User sets proxy URL in **Settings > Comfy > Network** (or via `--http-proxy` CLI arg) 2. On restart, the setting is read from `comfy.settings.json` 3. Environment variables `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY` are set before any network activity 4. All HTTP libraries (`aiohttp`, `requests`, `urllib`) + subprocesses (`git`, `pip`, `uv`) automatically route through the proxy 5. In the desktop app, Chromium's network stack is also configured via `session.setProxy()` ### Usage **CLI (standalone):** ```bash python main.py --http-proxy http://127.0.0.1:7890 ``` **Desktop app:** Set in Settings > Comfy > Network > "HTTP/HTTPS proxy URL", then restart. This covers all 6 `aiohttp.ClientSession` sites, all `requests.get()` calls, `urllib` downloads, custom nodes, and subprocesses — without modifying any individual call site.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/desktop#302
No description provided.