[GH-ISSUE #2342] Fallback (vles-tls) does not interact with the nginx server. #1611

Closed
opened 2026-10-31 20:19:58 +07:00 by bsakaguchi · 11 comments
Owner

Originally created by @anvar68 on GitHub (Jun 3, 2024).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/2342

Going to the address https://xxxxxxx.freemyip.com/ in the browser ends with the error message PR_END_OF_FILE_ERROR.
Nginx server - 127.0.0.1:8080
сonfig.json - fallbacks block:
"fallbacks": [
{
"alpn": "",
"dest": "@vless-ws",
"name": "",
"path": "/vlws",
"xver": 0
},
{
"alpn": "",
"dest": "8080",
"name": "",
"path": "",
"xver": 0
}
]
What settings are missing?

With similar settings, pure xray - https://github.com/XTLS/Xray-install works correctly.

P.S. Sorry for my English - machine translation.

Originally created by @anvar68 on GitHub (Jun 3, 2024). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/2342 Going to the address https://xxxxxxx.freemyip.com/ in the browser ends with the error message PR_END_OF_FILE_ERROR. Nginx server - 127.0.0.1:8080 сonfig.json - fallbacks block: "fallbacks": [ { "alpn": "", "dest": "@vless-ws", "name": "", "path": "/vlws", "xver": 0 }, { "alpn": "", "dest": "8080", "name": "", "path": "", "xver": 0 } ] What settings are missing? With similar settings, pure xray - https://github.com/XTLS/Xray-install works correctly. P.S. Sorry for my English - machine translation.
bsakaguchi 2026-10-31 20:19:58 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@alireza0 commented on GitHub (Jun 3, 2024):

Xver should be 1 or 2 to send the headers. Otherwise, nginx could not find the headers in proxy.
Same for first fallback toward another inbound.

You should enable proxy_protocol in next inbound as well.

<!-- gh-comment-id:2144922695 --> @alireza0 commented on GitHub (Jun 3, 2024): Xver should be 1 or 2 to send the headers. Otherwise, nginx could not find the headers in proxy. Same for first fallback toward another inbound. You should enable proxy_protocol in next inbound as well.
Author
Owner

@anvar68 commented on GitHub (Jun 3, 2024):

Thank you for your time.
No xVer combinations produce results (1:1, 2:2, 1:2, 2:1). Enabling and disabling proxy_protocol has no effect.
For the experiment, other inbounds are disabled.
Maybe there are other errors in the settings?
1
2

<!-- gh-comment-id:2145301745 --> @anvar68 commented on GitHub (Jun 3, 2024): Thank you for your time. No xVer combinations produce results (1:1, 2:2, 1:2, 2:1). Enabling and disabling proxy_protocol has no effect. For the experiment, other inbounds are disabled. Maybe there are other errors in the settings? ![1](https://github.com/MHSanaei/3x-ui/assets/155945862/7a6ce1ac-1463-4dbb-a68e-bdf94f52e205) ![2](https://github.com/MHSanaei/3x-ui/assets/155945862/fe649f17-251a-4c14-9488-4cbe634da5b6)
Author
Owner

@alireza0 commented on GitHub (Jun 3, 2024):

Sorry, but it is also wrong!
In inbound with fallback you should not enable proxy_protocol.

You should disable it here and enable it in inbound which listens on @vless-ws socket.

The xVer is very important if you want to pass the header. Just set it to 1 for both fallback options.

<!-- gh-comment-id:2145626312 --> @alireza0 commented on GitHub (Jun 3, 2024): Sorry, but it is also wrong! In inbound with fallback you should not enable proxy_protocol. You should disable it here and enable it in inbound which listens on `@vless-ws` socket. The xVer is very important if you want to pass the header. Just set it to 1 for both fallback options.
Author
Owner

@anvar68 commented on GitHub (Jun 3, 2024):

"You should disable it here and enable it in inbound which listens on @vless-ws socket."

How can this be done, and where is this setting located? In the settings, inbound proxy_protocol is not mentioned anywhere else.

<!-- gh-comment-id:2145958344 --> @anvar68 commented on GitHub (Jun 3, 2024): "You should disable it here and enable it in inbound which listens on @vless-ws socket." How can this be done, and where is this setting located? In the settings, inbound proxy_protocol is not mentioned anywhere else.
Author
Owner

@alireza0 commented on GitHub (Jun 3, 2024):

Follow the example here

<!-- gh-comment-id:2146283126 --> @alireza0 commented on GitHub (Jun 3, 2024): Follow the example [here](https://github.com/XTLS/Xray-examples/blob/main/All-in-One-fallbacks-Nginx/server.json)
Author
Owner

@anvar68 commented on GitHub (Jun 4, 2024):

Thank you, I have already seen this page and have not been able to configure it yet. That's why I asked the question here.

Initially the question was different.
In the ngnix - xtls working bundle (installed from https://github.com/XTLS/Xray-install) fallback worked.
Without changing ngnix settings, xtls was replaced with 3x-ui and fallback stopped working.
It turns out that the 3X-ui panel lacks the ability to configure correctly.

Okay, I'll look into it further.

<!-- gh-comment-id:2146627522 --> @anvar68 commented on GitHub (Jun 4, 2024): Thank you, I have already seen this page and have not been able to configure it yet. That's why I asked the question here. Initially the question was different. In the ngnix - xtls working bundle (installed from https://github.com/XTLS/Xray-install) fallback worked. Without changing ngnix settings, xtls was replaced with 3x-ui and fallback stopped working. It turns out that the 3X-ui panel lacks the ability to configure correctly. Okay, I'll look into it further.
Author
Owner

@anvar68 commented on GitHub (Jun 4, 2024):

Settings
VLESS-TCP-TLS
VLESS-TCP-TLS-proxy protocol
I do not work

<!-- gh-comment-id:2146758346 --> @anvar68 commented on GitHub (Jun 4, 2024): Settings [VLESS-TCP-TLS](https://github.com/XTLS/Xray-examples/tree/main/VLESS-TCP-TLS) [VLESS-TCP-TLS-proxy protocol](https://github.com/XTLS/Xray-examples/tree/main/VLESS-TCP-TLS-proxy%20protocol) I do not work
Author
Owner

@alireza0 commented on GitHub (Jun 10, 2024):

If it doesn't work, you did not follow the whole configuration.
You should have two inbounds:

  1. Fallback: Vless TCP+TLS with only fallbacks on configuration. (DONT USE PROXY PROTOCOL HERE)
  2. Child: Vleaa/Vmees/Trojan/Shadowsocks (WITHOUT TLS) tcp/ws/httpupgrade and ENABLED PROXY PROTOCOL - with same path as you defined in fallback config in 1st inbound.

Then client will use first inbound port to connect and fallback will pass it to 2nd inbound. TLS will be handled by 1st inbound.

For other fallbacks that you want to handle it by nginx, you can use following config:
In x-ui's fallback inbound:
image

In nginx you can answer requests by a json. Configuration could be like this:

server {
        listen 127.0.0.1:1001 proxy_protocol;
        listen 127.0.0.1:1002 http2 proxy_protocol;

        server_name  _;

        root    /var/www/html;
        real_ip_header proxy_protocol;
        set_real_ip_from 127.0.0.1;

        location / {
            default_type application/json;
            return 200 '{"code":"1", "message": "404 Not Found"}';
        }
}
<!-- gh-comment-id:2158224237 --> @alireza0 commented on GitHub (Jun 10, 2024): If it doesn't work, you did not follow the whole configuration. You should have two inbounds: 1. Fallback: Vless TCP+TLS with only fallbacks on configuration. (DONT USE PROXY PROTOCOL HERE) 2. Child: Vleaa/Vmees/Trojan/Shadowsocks (WITHOUT TLS) tcp/ws/httpupgrade and ENABLED PROXY PROTOCOL - with same path as you defined in fallback config in 1st inbound. Then client will use first inbound port to connect and fallback will pass it to 2nd inbound. TLS will be handled by 1st inbound. For other fallbacks that you want to handle it by nginx, you can use following config: In x-ui's fallback inbound: ![image](https://github.com/MHSanaei/3x-ui/assets/12573084/d4b14d31-bb7c-43be-ac18-7df51aa1e1c9) In nginx you can answer requests by a json. Configuration could be like this: ```nginx server { listen 127.0.0.1:1001 proxy_protocol; listen 127.0.0.1:1002 http2 proxy_protocol; server_name _; root /var/www/html; real_ip_header proxy_protocol; set_real_ip_from 127.0.0.1; location / { default_type application/json; return 200 '{"code":"1", "message": "404 Not Found"}'; } } ```
Author
Owner

@EryX0 commented on GitHub (Jun 14, 2024):

If it doesn't work, you did not follow the whole configuration. You should have two inbounds:

  1. Fallback: Vless TCP+TLS with only fallbacks on configuration. (DONT USE PROXY PROTOCOL HERE)
  2. Child: Vleaa/Vmees/Trojan/Shadowsocks (WITHOUT TLS) tcp/ws/httpupgrade and ENABLED PROXY PROTOCOL - with same path as you defined in fallback config in 1st inbound.

thanks for the detailed explanation and sorry to jump in to the issue like this.

could this method be used to give a user with 1 uuid, multiple inbounds ? for example Cloudflare CDN, tunnel, etc?
trying to achieve this :
if user uses whichever of these configurations, its volume should be subtracted unified with other configurations.

<!-- gh-comment-id:2167413741 --> @EryX0 commented on GitHub (Jun 14, 2024): > If it doesn't work, you did not follow the whole configuration. You should have two inbounds: > > 1. Fallback: Vless TCP+TLS with only fallbacks on configuration. (DONT USE PROXY PROTOCOL HERE) > 2. Child: Vleaa/Vmees/Trojan/Shadowsocks (WITHOUT TLS) tcp/ws/httpupgrade and ENABLED PROXY PROTOCOL - with same path as you defined in fallback config in 1st inbound. thanks for the detailed explanation and sorry to jump in to the issue like this. could this method be used to give a user with 1 uuid, multiple inbounds ? for example Cloudflare CDN, tunnel, etc? trying to achieve this : if user uses whichever of these configurations, its volume should be subtracted unified with other configurations.
Author
Owner

@alireza0 commented on GitHub (Jun 14, 2024):

In this structure it is not possible yet to have one client in several inbounds. But using external proxy configuration you can define several server Name/IP and port which points to a same inbound at the end. Then you can use other proxies like CF to create multiple links

<!-- gh-comment-id:2167818393 --> @alireza0 commented on GitHub (Jun 14, 2024): In this structure it is not possible yet to have one client in several inbounds. But using `external proxy` configuration you can define several server Name/IP and port which points to a same inbound at the end. Then you can use other proxies like CF to create multiple links
Author
Owner

@EryX0 commented on GitHub (Jun 14, 2024):

In this structure it is not possible yet to have one client in several inbounds. But using external proxy configuration you can define several server Name/IP and port which points to a same inbound at the end. Then you can use other proxies like CF to create multiple links

but we can't give out multiple connection configs with various protocols to users right?
for example if we create the inbound as Vless ws (or HttpUpgrade), we can't give out tcp reality or tcp tunnel configuration to users? we only can use cf as external proxy CDN to give out the vless ws configuration with multiple IPs.

<!-- gh-comment-id:2168707930 --> @EryX0 commented on GitHub (Jun 14, 2024): > In this structure it is not possible yet to have one client in several inbounds. But using `external proxy` configuration you can define several server Name/IP and port which points to a same inbound at the end. Then you can use other proxies like CF to create multiple links but we can't give out multiple connection configs with various protocols to users right? for example if we create the inbound as Vless ws (or HttpUpgrade), we can't give out tcp reality or tcp tunnel configuration to users? we only can use cf as external proxy CDN to give out the vless ws configuration with multiple IPs.
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#1611
No description provided.