[GH-ISSUE #5108] [Question]: 3rd level domain #3586

Closed
opened 2026-10-31 20:33:31 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @MahdiMz80 on GitHub (Jun 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5108

What are you trying to do?

In the initial installation of the panel using the install.sh, I did set a 3rd level domain as the domain for usage (s-vn.haji.pp.ua) and gave the path for the cert files that were gotten using certbot from let's encrypt (etc/letsencrypt/live/...), for the 2nd level domain itself and its any 3rd level subdomains as wildcard (haji.pp.ua, *.haji.pp.ua)

After the setup, I noticed the option 10 of x-ui shows the access address as haji.pp.ua instead of s-vn.haji.pp.ua.
Meanwhile I could have accessed the panel via s-vn.haji.pp.ua, Ihad multiple of random timeouts on both panel and sub webpages, along with ssl handshake timeouts visible in the debug logs (restarting the panel and xray via cli was sometimes solving the timeout at reaching panel/sub temporarily, probably until doing any edition in the panel that needed xray restarting [not sure] - restarting xray from the panel wasn't solving anything)

The main problem was that any kind of inbounds i made, clients were unable to connect to the internet using them.

Despite it showing s-vn.haji.pp.ua as the address in the configs, I was curious if x-ui is probably building the configs on haji.pp.ua instead of s-vn.haji.pp.ua (just like it shows it as the access url) hence why none of configs I made worked.
I thought it might also be related to how I've configured my domain and its certificate, but everything seems to be done correctly, that's why I thought it might be related on how x-ui handles the 3rd level domains wrongly.

(Additionally if there's any community of users, would be nice if you gimme its details as well)

What have you already tried?

Uninstalled x-ui totally and reinstalled by configuring the ip address instead of adding any domain (also got ssl for ip using the installation script itself) and now my clients seem to have connection to the internet using the same inbounds.

3x-ui version

3.2.8

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24.04

Screenshots or config snippets

No response

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 @MahdiMz80 on GitHub (Jun 9, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5108 ### What are you trying to do? In the initial installation of the panel using the install.sh, I did set a 3rd level domain as the domain for usage (s-vn.haji.pp.ua) and gave the path for the cert files that were gotten using certbot from let's encrypt (etc/letsencrypt/live/...), for the 2nd level domain itself and its any 3rd level subdomains as wildcard (haji.pp.ua, *.haji.pp.ua) After the setup, I noticed the option 10 of x-ui shows the access address as haji.pp.ua instead of s-vn.haji.pp.ua. Meanwhile I could have accessed the panel via s-vn.haji.pp.ua, Ihad multiple of random timeouts on both panel and sub webpages, along with ssl handshake timeouts visible in the debug logs (restarting the panel and xray via cli was sometimes solving the timeout at reaching panel/sub temporarily, probably until doing any edition in the panel that needed xray restarting [not sure] - restarting xray from the panel wasn't solving anything) The main problem was that any kind of inbounds i made, clients were unable to connect to the internet using them. Despite it showing s-vn.haji.pp.ua as the address in the configs, I was curious if x-ui is probably building the configs on haji.pp.ua instead of s-vn.haji.pp.ua (just like it shows it as the access url) hence why none of configs I made worked. I thought it might also be related to how I've configured my domain and its certificate, but everything seems to be done correctly, that's why I thought it might be related on how x-ui handles the 3rd level domains wrongly. (Additionally if there's any community of users, would be nice if you gimme its details as well) ### What have you already tried? Uninstalled x-ui totally and reinstalled by configuring the ip address instead of adding any domain (also got ssl for ip using the installation script itself) and now my clients seem to have connection to the internet using the same inbounds. ### 3x-ui version 3.2.8 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24.04 ### Screenshots or config snippets _No response_ ### 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:33:31 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 9, 2026):

Thanks for the detailed report. I traced this through the source to give you a precise answer.

What you're seeing in option 10 (View Settings)

The display of the Access URL in the x-ui management menu (option 10 → check_config() in x-ui.sh, line 363) derives the domain name by doing:

local domain=$(basename "$(dirname "$existing_cert")")

It takes the parent directory name of your cert file path. If your cert path is /etc/letsencrypt/live/haji.pp.ua/fullchain.pem, then dirname gives /etc/letsencrypt/live/haji.pp.ua and basename gives haji.pp.ua — so it always shows the cert-directory name, regardless of which subdomain you actually use to access the panel.

This is a known cosmetic bug (see related #5070). It only affects the display in the CLI menu.

Does x-ui use the wrong domain for inbound configs?

No. The Xray inbound configurations are built entirely from the settings you explicitly set when creating each inbound in the web panel. There is no logic anywhere in the codebase that reads the cert file path to inject a domain into inbound configs. Whatever address you entered in the inbound form is what goes into the client configs.

Why the panel/sub page timeouts?

The panel's domain filter (webDomain setting, used in DomainValidatorMiddleware) defaults to an empty string and is never set by x-ui cert or the installation flow. When it's empty, the middleware is not installed (see web/web.go line 160–162), so requests to s-vn.haji.pp.ua are not rejected at the HTTP layer.

The SSL timeouts you observed are more likely explained by one or more of these factors:

  1. Port conflict between the panel/sub and an inbound. If any Xray inbound was configured on the same port as the panel or subscription server, they would fight for the socket after each Xray restart, causing intermittent connection failures until a manual restart resolved the conflict.
  2. Sub-server TLS cert path. updateCert in main.go applies the same cert/key to both the panel and the subscription server (SetSubCertFile/SetSubKeyFile). If the cert or key file was not readable (e.g. Let's Encrypt certs in /etc/letsencrypt/live/ default to root-only permissions), TLS would fail to load and fall back to HTTP, causing handshake errors from clients expecting HTTPS.
  3. Wildcard cert SAN matching. A cert issued for haji.pp.ua + *.haji.pp.ua covers s-vn.haji.pp.ua at one level deep. If any inbound used haji.pp.ua as a serverName in its TLS/REALITY settings, that is correct; no issue there.

What actually fixed it for you

Reinstalling with IP address avoids any DNS/subdomain resolution step, so connectivity issues that were DNS-related or cert-path-related would disappear. The inbound functionality is identical regardless of whether you use a domain or IP.

If you want to keep using s-vn.haji.pp.ua

  1. Make sure the Let's Encrypt cert files are readable by the x-ui process (chmod 644 /etc/letsencrypt/live/haji.pp.ua/fullchain.pem /etc/letsencrypt/live/haji.pp.ua/privkey.pem or copy them to /root/cert/s-vn.haji.pp.ua/).
  2. Verify no inbound shares the panel port or sub port.
  3. The display showing haji.pp.ua in option 10 is harmless — the panel is fully accessible via s-vn.haji.pp.ua.
<!-- gh-comment-id:4655515938 --> @github-actions[bot] commented on GitHub (Jun 9, 2026): Thanks for the detailed report. I traced this through the source to give you a precise answer. ## What you're seeing in option 10 (View Settings) The display of the Access URL in the `x-ui` management menu (option 10 → `check_config()` in `x-ui.sh`, line 363) derives the domain name by doing: ```bash local domain=$(basename "$(dirname "$existing_cert")") ``` It takes the **parent directory name of your cert file path**. If your cert path is `/etc/letsencrypt/live/haji.pp.ua/fullchain.pem`, then `dirname` gives `/etc/letsencrypt/live/haji.pp.ua` and `basename` gives `haji.pp.ua` — so it always shows the cert-directory name, regardless of which subdomain you actually use to access the panel. This is a known cosmetic bug (see related #5070). It **only affects the display** in the CLI menu. ## Does x-ui use the wrong domain for inbound configs? No. The Xray inbound configurations are built entirely from the settings you explicitly set when creating each inbound in the web panel. There is no logic anywhere in the codebase that reads the cert file path to inject a domain into inbound configs. Whatever address you entered in the inbound form is what goes into the client configs. ## Why the panel/sub page timeouts? The panel's domain filter (`webDomain` setting, used in `DomainValidatorMiddleware`) defaults to an empty string and is **never set** by `x-ui cert` or the installation flow. When it's empty, the middleware is not installed (see `web/web.go` line 160–162), so requests to `s-vn.haji.pp.ua` are not rejected at the HTTP layer. The SSL timeouts you observed are more likely explained by one or more of these factors: 1. **Port conflict between the panel/sub and an inbound.** If any Xray inbound was configured on the same port as the panel or subscription server, they would fight for the socket after each Xray restart, causing intermittent connection failures until a manual restart resolved the conflict. 2. **Sub-server TLS cert path.** `updateCert` in `main.go` applies the same cert/key to both the panel and the subscription server (`SetSubCertFile`/`SetSubKeyFile`). If the cert or key file was not readable (e.g. Let's Encrypt certs in `/etc/letsencrypt/live/` default to root-only permissions), TLS would fail to load and fall back to HTTP, causing handshake errors from clients expecting HTTPS. 3. **Wildcard cert SAN matching.** A cert issued for `haji.pp.ua` + `*.haji.pp.ua` covers `s-vn.haji.pp.ua` at one level deep. If any inbound used `haji.pp.ua` as a `serverName` in its TLS/REALITY settings, that is correct; no issue there. ## What actually fixed it for you Reinstalling with IP address avoids any DNS/subdomain resolution step, so connectivity issues that were DNS-related or cert-path-related would disappear. The inbound functionality is identical regardless of whether you use a domain or IP. ## If you want to keep using `s-vn.haji.pp.ua` 1. Make sure the Let's Encrypt cert files are readable by the x-ui process (`chmod 644 /etc/letsencrypt/live/haji.pp.ua/fullchain.pem /etc/letsencrypt/live/haji.pp.ua/privkey.pem` or copy them to `/root/cert/s-vn.haji.pp.ua/`). 2. Verify no inbound shares the panel port or sub port. 3. The display showing `haji.pp.ua` in option 10 is harmless — the panel is fully accessible via `s-vn.haji.pp.ua`.
Author
Owner

@rqzbeh commented on GitHub (Jun 9, 2026):

Wild card cert can only be get by dns based method and not http based.
Panel itself can only get wildcard cert from cloudflare using API (option 20)
For manual wildcard certification try this:
https://community.letsencrypt.org/t/dns-label-for-wildcard-certificate-validation/50415

<!-- gh-comment-id:4656295602 --> @rqzbeh commented on GitHub (Jun 9, 2026): Wild card cert can only be get by dns based method and not http based. Panel itself can only get wildcard cert from cloudflare using API (option 20) For manual wildcard certification try this: https://community.letsencrypt.org/t/dns-label-for-wildcard-certificate-validation/50415
Author
Owner

@MahdiMz80 commented on GitHub (Jun 9, 2026):

Wild card cert can only be get by dns based method and not http based. Panel itself can only get wildcard cert from cloudflare using API (option 20) For manual wildcard certification try this: https://community.letsencrypt.org/t/dns-label-for-wildcard-certificate-validation/50415

I mean getting the certificate is not an issue, I own haji.pp.ua domain, so I have it added in cloudflare dashboard, and already got a certificate for haji.pp.ua and *.haji.pp.ua.
My problem is that none of the inbounds worked after I had set s-vn.haji.pp.ua while installing the panel, and I can't figure out what was causing that exactly.

Do I need to skip ssl certificate and install based on IP address, then just move my certificate from let's encrypt's path to the root certificate path that x-ray scans and try adding the domain from there instead?

Additionally if anyone is experienced enough with this, I'll happily give access to my domain to try if it's basically possible to do with this kind of 3rd level domains or not (or maybe I'm doing something wrong but at least I'll know if I'm trying for nothing or not)

<!-- gh-comment-id:4660874588 --> @MahdiMz80 commented on GitHub (Jun 9, 2026): > Wild card cert can only be get by dns based method and not http based. Panel itself can only get wildcard cert from cloudflare using API (option 20) For manual wildcard certification try this: https://community.letsencrypt.org/t/dns-label-for-wildcard-certificate-validation/50415 I mean getting the certificate is not an issue, I own haji.pp.ua domain, so I have it added in cloudflare dashboard, and already got a certificate for haji.pp.ua and *.haji.pp.ua. My problem is that none of the inbounds worked after I had set s-vn.haji.pp.ua while installing the panel, and I can't figure out what was causing that exactly. Do I need to skip ssl certificate and install based on IP address, then just move my certificate from let's encrypt's path to the root certificate path that x-ray scans and try adding the domain from there instead? Additionally if anyone is experienced enough with this, I'll happily give access to my domain to try if it's basically possible to do with this kind of 3rd level domains or not (or maybe I'm doing something wrong but at least I'll know if I'm trying for nothing or not)
Author
Owner

@MHSanaei commented on GitHub (Jul 3, 2026):

To answer the core question: no — 3x-ui never builds inbound or share configs from the certificate path. The address in generated configs comes only from what you set on the inbound (or the request host), so third-level domains like s-vn.haji.pp.ua are fully supported, and a wildcard *.haji.pp.ua certificate covers them. The domain shown in menu option 10 is informational only — it's derived from the certificate folder name and its SANs (improved in #5070) and has no effect on Xray configs.

The connection problems you saw are most likely file permissions on the Let's Encrypt cert/key (copy them somewhere readable, e.g. /root/cert/<domain>/, and point the panel there) or a port shared between the panel/sub server and an inbound.

Closing as answered; feel free to open a new question with panel logs if it recurs.

<!-- gh-comment-id:4873842264 --> @MHSanaei commented on GitHub (Jul 3, 2026): To answer the core question: no — 3x-ui never builds inbound or share configs from the certificate path. The address in generated configs comes only from what you set on the inbound (or the request host), so third-level domains like `s-vn.haji.pp.ua` are fully supported, and a wildcard `*.haji.pp.ua` certificate covers them. The domain shown in menu option 10 is informational only — it's derived from the certificate folder name and its SANs (improved in #5070) and has no effect on Xray configs. The connection problems you saw are most likely file permissions on the Let's Encrypt cert/key (copy them somewhere readable, e.g. `/root/cert/<domain>/`, and point the panel there) or a port shared between the panel/sub server and an inbound. Closing as answered; feel free to open a new question with panel logs if it recurs.
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#3586
No description provided.