[PR #6259] [MERGED] fix(panel): forward the panel's proxy to update.sh's own downloads #6200

Closed
opened 2026-11-02 04:07:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6259
Author: @kuzzrus
Created: 8/18/2026
Status: ✅ Merged
Merged: 8/24/2026
Merged by: @MHSanaei

Base: main ← Head: upstream-pr/panel-update-proxy


📝 Commits (6)

  • d7e9c4f fix(panel): route update.sh's own downloads through the resolved proxy
  • bd98995 test(panel): cover updateProxyEnvVars' ambient-proxy path
  • 02cc009 fix: drop the panel-outbound fallback in updateProxyEnvVars
  • fbf4fe7 Merge branch 'main' into upstream-pr/panel-update-proxy
  • 9734457 Merge branch 'main' into upstream-pr/panel-update-proxy
  • cb5278e Merge branch 'main' into upstream-pr/panel-update-proxy

📊 Changes

2 files changed (+64 additions, -6 deletions)

View changed files

📝 internal/web/service/panel/panel.go (+23 -6)
📝 internal/web/service/panel/panel_test.go (+41 -0)

📄 Description

Summary

startUpdate already fetches update.sh itself through a proxy-aware HTTP client (NewProxiedHTTPClient), but the process that actually executes update.sh never receives a proxy hint of its own — so update.sh's own curl calls to GitHub always go out directly, even when the panel has a working proxy path configured.

Why

This is most visible on the systemd-run launch path: systemd-run does not inherit the caller's environment at all (only --setenv passes through), so a host that needs a proxy to reach GitHub loses it for this one hop even though every other panel-outbound request (the version check, the update.sh download itself) already goes through it correctly.

curl already honors https_proxy/all_proxy natively, so no changes to update.sh are needed — only the launcher needs to forward a proxy URL into the environment it hands to the detached process.

updateProxyEnvVars() prefers an already-set ambient proxy env var (never silently overriding an admin's own proxy config) and only falls back to the panel's own configured panel outbound (PanelEgressProxyURL) when nothing is set, then forwards the result to both launch paths (--setenv for systemd-run, cmd.Env for the bash -lc fallback).

Type of change

  • Bug fix

Areas affected

  • Backend (API endpoints, login, settings)

How was this tested?

internal/web/service/panel transitively imports internal/database (CGO/sqlite3), which I wasn't able to compile in my local environment. I added TestUpdateProxyEnvVarsPrefersAmbientProxy, which exercises the ambient-proxy branch directly (it never touches PanelEgressProxyURL/the database, so it needs no DB test scaffolding), and manually checked the new call against NewProxiedHTTPClient's existing call pattern already used elsewhere in this same file. I was not able to run go build/the full test suite myself — would appreciate CI or a maintainer confirming those, and ideally a real update run on a host that actually needs a proxy to reach GitHub.

Screenshots / recordings

N/A — backend-only change.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior. (blocked by the local CGO/sqlite3 gap above, not skipped by choice)
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally. (same CGO blocker; should be green in CI)
  • For frontend changes: N/A, backend-only.
  • I updated the Wiki / README / API docs if user-facing behavior changed. (no user-facing behavior changed)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6259 **Author:** [@kuzzrus](https://github.com/kuzzrus) **Created:** 8/18/2026 **Status:** ✅ Merged **Merged:** 8/24/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `upstream-pr/panel-update-proxy` --- ### 📝 Commits (6) - [`d7e9c4f`](https://github.com/MHSanaei/3x-ui/commit/d7e9c4f5230308f4bc98a237f1027ff6af16c3be) fix(panel): route update.sh's own downloads through the resolved proxy - [`bd98995`](https://github.com/MHSanaei/3x-ui/commit/bd98995f1f00efb397fb58a849cc7caa0cd96a47) test(panel): cover updateProxyEnvVars' ambient-proxy path - [`02cc009`](https://github.com/MHSanaei/3x-ui/commit/02cc009c81ec1010f74ced3028ae33fb229403c5) fix: drop the panel-outbound fallback in updateProxyEnvVars - [`fbf4fe7`](https://github.com/MHSanaei/3x-ui/commit/fbf4fe78177ac5ed4e20a501b4edcff2ec7c85eb) Merge branch 'main' into upstream-pr/panel-update-proxy - [`9734457`](https://github.com/MHSanaei/3x-ui/commit/97344575c9583f5f2ffb02edb5d50243526f1d4d) Merge branch 'main' into upstream-pr/panel-update-proxy - [`cb5278e`](https://github.com/MHSanaei/3x-ui/commit/cb5278e044a4799a54efc6f6313c2f6e3ce906fb) Merge branch 'main' into upstream-pr/panel-update-proxy ### 📊 Changes **2 files changed** (+64 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/panel/panel.go` (+23 -6) 📝 `internal/web/service/panel/panel_test.go` (+41 -0) </details> ### 📄 Description ## Summary `startUpdate` already fetches `update.sh` itself through a proxy-aware HTTP client (`NewProxiedHTTPClient`), but the process that actually executes `update.sh` never receives a proxy hint of its own — so `update.sh`'s own `curl` calls to GitHub always go out directly, even when the panel has a working proxy path configured. ## Why This is most visible on the `systemd-run` launch path: `systemd-run` does not inherit the caller's environment at all (only `--setenv` passes through), so a host that needs a proxy to reach GitHub loses it for this one hop even though every other panel-outbound request (the version check, the `update.sh` download itself) already goes through it correctly. `curl` already honors `https_proxy`/`all_proxy` natively, so no changes to `update.sh` are needed — only the launcher needs to forward a proxy URL into the environment it hands to the detached process. `updateProxyEnvVars()` prefers an already-set ambient proxy env var (never silently overriding an admin's own proxy config) and only falls back to the panel's own configured panel outbound (`PanelEgressProxyURL`) when nothing is set, then forwards the result to both launch paths (`--setenv` for `systemd-run`, `cmd.Env` for the `bash -lc` fallback). ## Type of change - [x] Bug fix ## Areas affected - [x] Backend (API endpoints, login, settings) ## How was this tested? `internal/web/service/panel` transitively imports `internal/database` (CGO/sqlite3), which I wasn't able to compile in my local environment. I added `TestUpdateProxyEnvVarsPrefersAmbientProxy`, which exercises the ambient-proxy branch directly (it never touches `PanelEgressProxyURL`/the database, so it needs no DB test scaffolding), and manually checked the new call against `NewProxiedHTTPClient`'s existing call pattern already used elsewhere in this same file. I was not able to run `go build`/the full test suite myself — would appreciate CI or a maintainer confirming those, and ideally a real update run on a host that actually needs a proxy to reach GitHub. ## Screenshots / recordings N/A — backend-only change. ## Breaking changes None. ## Checklist - [ ] I tested the change locally and confirmed the described behavior. (blocked by the local CGO/sqlite3 gap above, not skipped by choice) - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. (same CGO blocker; should be green in CI) - [x] For frontend changes: N/A, backend-only. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. (no user-facing behavior changed) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:03 +07:00
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
MHSanaei/3x-ui#6200
No description provided.