[GH-ISSUE #4629] [Bug]: client link generation is broken behind a reverse proxy #3183

Closed
opened 2026-10-31 20:30:38 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @unti1x on GitHub (May 28, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4629

Describe the bug

The server uses X-Real-IP header to generate links when X-Forwarded-Host is not set. This affects normal links and qrcodes (/panel/api/clients/subLinks/:id) but not "Export inbound links" dialog since it's client-side.

I don't think X-Real-IP should be used at all. And I don't really understand why the panel doesn't use just Host or a host name from its settings

How to reproduce the problem

  1. host a panel behind a reverse proxy.
  2. configure headers, set X-Real-IP but not X-Forwarded-Host
        location / {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Range $http_range;
                proxy_set_header If-Range $http_if_range;
                proxy_redirect off;
                proxy_pass http://127.0.0.1:2053;
        }
  1. open qrcode for any user, press "Copy link"

Expected behavior

The link contains a proper domain name

Actual behavior

The link contains current user's ip instead of a domain name

Relevant logs


Screenshots

No response

3x-ui version

3.1.0 and above

Xray-core version

No response

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Ubuntu 24.04

Which parts of the panel are affected?

Subscription (share links / Clash / JSON)

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

Yes — Nginx

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @unti1x on GitHub (May 28, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4629 ### Describe the bug The server uses `X-Real-IP` header to generate links when `X-Forwarded-Host` is not set. This affects normal links and qrcodes (`/panel/api/clients/subLinks/:id`) but not "Export inbound links" dialog since it's client-side. I don't think `X-Real-IP` should be used at all. And I don't really understand why the panel doesn't use just `Host` or a host name from its settings ### How to reproduce the problem 1. host a panel behind a reverse proxy. 2. configure headers, set X-Real-IP but not X-Forwarded-Host ``` location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Range $http_range; proxy_set_header If-Range $http_if_range; proxy_redirect off; proxy_pass http://127.0.0.1:2053; } ``` 3. open qrcode for any user, press "Copy link" ### Expected behavior The link contains a proper domain name ### Actual behavior The link contains current user's ip instead of a domain name ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.1.0 and above ### Xray-core version _No response_ ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Ubuntu 24.04 ### Which parts of the panel are affected? Subscription (share links / Clash / JSON) ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? Yes — Nginx ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:30:38 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@MHSanaei commented on GitHub (May 28, 2026):

How did you install 3x-ui?
Docker / Docker Compose

the docker version still not ready how did you install it
https://github.com/MHSanaei/3x-ui/actions/runs/26599162626

<!-- gh-comment-id:4568105061 --> @MHSanaei commented on GitHub (May 28, 2026): How did you install 3x-ui? Docker / Docker Compose the docker version still not ready how did you install it https://github.com/MHSanaei/3x-ui/actions/runs/26599162626
Author
Owner

@unti1x commented on GitHub (May 30, 2026):

Docker and manual build. I mean I tested it on the main branch as well.

<!-- gh-comment-id:4584459689 --> @unti1x commented on GitHub (May 30, 2026): Docker and manual build. I mean I tested it on the main branch as well.
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#3183
No description provided.