[GH-ISSUE #6021] [Question]: sub and config problem in tg bot #4170

Closed
opened 2026-10-31 20:37:41 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @1sardaar on GitHub (Jul 17, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6021

What are you trying to do?

In the bot, when retrieving the subscription URL, the full domain is not included in the link. It only contains the domain name, without the subdomain and without the top-level domain (TLD).

Also, when retrieving the configuration link, a certificate-related error occurs because the domain is incomplete.

How should I fix this?

What have you already tried?

No response

3x-ui version

3.5.0

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 22.04

Screenshots or config snippets

Image Image

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @1sardaar on GitHub (Jul 17, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6021 ### What are you trying to do? > In the bot, when retrieving the subscription URL, the full domain is not included in the link. It only contains the domain name, without the subdomain and without the top-level domain (TLD). Also, when retrieving the configuration link, a certificate-related error occurs because the domain is incomplete. How should I fix this? ### What have you already tried? _No response_ ### 3x-ui version 3.5.0 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 22.04 ### Screenshots or config snippets <img width="1080" height="712" alt="Image" src="https://github.com/user-attachments/assets/11f500e5-f4a0-4ac5-a8d4-c798cc8ee5b1" /> <img width="1080" height="293" alt="Image" src="https://github.com/user-attachments/assets/bad9e051-3692-44ee-890e-5bda4eed02cf" /> ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
bsakaguchi 2026-10-31 20:37:41 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 17, 2026):

This is the same issue as #5851, where the root cause was already confirmed in the source and is still present on 3.5.0.

Root cause: the Telegram bot builds subscription/config links in buildSubscriptionURLs (internal/web/service/tgbot/tgbot_client.go:142-177). It resolves the host in this order:

  1. subURI (Subscription Settings -> Reverse Proxy URI), used verbatim if set.
  2. subDomain (Subscription Settings -> Listen Domain).
  3. webDomain (Panel Settings -> Listen Domain).
  4. The server's OS hostname (os.Hostname(), cached at bot startup).
  5. "localhost".

Both subDomain and webDomain default to an empty string (internal/web/service/setting.go:46,101). When neither is set, the bot falls through to the OS hostname, which is normally just the machine's short label - no subdomain, no TLD - matching what you're seeing. This also explains the certificate error on the config link: your TLS certificate's SAN covers your real FQDN, not the bare hostname the bot inserted into the URL, so validation fails.

The panel/web UI does not have this problem because its subscription link is built from the incoming HTTP request's Host header when subDomain is blank (BuildSubURIBase in internal/web/service/setting.go:1339) - the bot has no HTTP request to read a host from, so it can't do the same.

Fix: in the panel, go to Panel Settings -> Subscription Settings and set either:

  • Listen Domain (subDomain) to your full domain, e.g. sub.example.com, or
  • Reverse Proxy URI (subURI) to the full base URL, e.g. https://sub.example.com/sub/

subURI/subDomain are checked before the hostname fallback, so either one will make the bot's links match your real domain and certificate.

Closing as a duplicate of #5851 - please continue the discussion there if this does not resolve it.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5006753919 --> @github-actions[bot] commented on GitHub (Jul 17, 2026): This is the same issue as #5851, where the root cause was already confirmed in the source and is still present on `3.5.0`. **Root cause:** the Telegram bot builds subscription/config links in `buildSubscriptionURLs` (`internal/web/service/tgbot/tgbot_client.go:142-177`). It resolves the host in this order: 1. `subURI` (Subscription Settings -> Reverse Proxy URI), used verbatim if set. 2. `subDomain` (Subscription Settings -> Listen Domain). 3. `webDomain` (Panel Settings -> Listen Domain). 4. The server's OS hostname (`os.Hostname()`, cached at bot startup). 5. `"localhost"`. Both `subDomain` and `webDomain` default to an empty string (`internal/web/service/setting.go:46,101`). When neither is set, the bot falls through to the OS hostname, which is normally just the machine's short label - no subdomain, no TLD - matching what you're seeing. This also explains the certificate error on the config link: your TLS certificate's SAN covers your real FQDN, not the bare hostname the bot inserted into the URL, so validation fails. The panel/web UI does not have this problem because its subscription link is built from the incoming HTTP request's `Host` header when `subDomain` is blank (`BuildSubURIBase` in `internal/web/service/setting.go:1339`) - the bot has no HTTP request to read a host from, so it can't do the same. **Fix:** in the panel, go to Panel Settings -> Subscription Settings and set either: - `Listen Domain` (`subDomain`) to your full domain, e.g. `sub.example.com`, or - `Reverse Proxy URI` (`subURI`) to the full base URL, e.g. `https://sub.example.com/sub/` `subURI`/`subDomain` are checked before the hostname fallback, so either one will make the bot's links match your real domain and certificate. Closing as a duplicate of #5851 - please continue the discussion there if this does not resolve it. *This reply was generated automatically; a maintainer may follow up.*
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#4170
No description provided.