mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5073] [Bug]: Telegram Bot doesnt work via panel proxy #3572
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3572
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Loginlag on GitHub (Jun 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5073
Describe the bug
Telegram bot is not routed through a socks5 proxy even though I specified it in the panel settings
I tried doing exactly the same thing on another server (3x-ui version 2.9.3), and everything worked as it should
Also I tried to replace telegram bot tokens but it didnt work.
How to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
3x-ui latest version (3.2.8)

3x-ui version 2.9.3

3x-ui version
3.2.8
Xray-core version
26.6.1
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Debian 12
Which parts of the panel are affected?
Telegram bot
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No — direct access
Before submitting
Also a bit offtop: link on existing issues when filling out the form is broken
@github-actions[bot] commented on GitHub (Jun 8, 2026):
Thanks for the detailed report, including the Xray log comparison — that clue is actually what pinpoints the exact cause.
What's happening
Starting with v3.2.0, the dedicated Telegram Bot Proxy field was removed from the Telegram settings tab. As a replacement, the bot code (
web/service/tgbot.go,Start()) now falls back to the Panel Network Proxy (panelProxy) field found under Settings → General, if no dedicatedtgBotProxyvalue is stored. That fallback logic is correct in the code.The bug is in how the "Restart Panel" button behaves:
SIGHUP, which callsStartPanelOnly()internally.StartPanelOnly()is wired tostart(restartXray=false, startTgBot=false)— it intentionally does not restart the Telegram bot.This explains the symptom you observed:
api.github.comgoes through the proxy (GitHub version checks callNewProxiedHTTPClienton every request, so they always pick up the currentpanelProxyvalue), but the Telegram bot does not (its fasthttp client is built once at startup and cached for the lifetime of the process).Workaround
After setting Panel Network Proxy (
socks5://login:password@127.0.0.1:1050) in the settings and saving, perform a full container restart instead of using "Restart Panel":This causes the service to go through
server.Start()→start(restartXray=true, startTgBot=true), which rebuilds the bot's HTTP client with the new proxy.The "Restart Panel" button alone is not sufficient for proxy changes to reach the Telegram bot.
Root cause summary
startTgBot=falsedocker restart 3x-ui/systemctl restart x-uiStart()The correct long-term fix would be for the
SIGHUPrestart path to also stop and restart the bot when it is enabled (i.e., passstartTgBot=trueinStartPanelOnly, or stop the bot inStopPanelOnly).@Serg-lab26 commented on GitHub (Jun 8, 2026):
In the old version of 3x-ui, the proxy settings for the tg bot in the SQL database used the table ID 20 key tgBotProxy, but in the new version, the settings are saved in ID 83 key panelProxy. After upgrading to the new version, 3x-ui continues to use ID 20.
@Loginlag commented on GitHub (Jun 8, 2026):
all it really took was to do
docker compose restartits quite unobvious imho. I expected that simply restarting panel via the gui would be enough