Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

Unable to process parse X-Forwarded-For correctly

Open MEM-917 opened this issue 2 years ago • 7 comments

After updating to the newest cores and checking logs for haproxy, nginx and xray, although IP entries passed over to xray register for Reality and gRPC, WebSocket doesn't register client IP. For more investigation, I downgraded the core to 1.8.16 and everything works flawlessly. Has anyone else noticed this?

MEM-917 avatar Jul 16 '24 23:07 MEM-917

Might be a bug. What is "register client ip" please follow the issue template

Fangliding avatar Jul 17 '24 01:07 Fangliding

What is "register client ip"

Client's real IP. Whether it is behind the CDN or it is the real IP.

In these tests, only the core has been changed and all the configs of nginx and haproxy are the same.

Here is the log of 1.8.18:

2024/07/16 21:27:57 127.0.0.1:15364 accepted tcp:speedtest.us-west-02.lunavi.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15366 accepted tcp:speedtest.mtc4me.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15380 accepted tcp:speedtest.ideatek.com:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15390 accepted tcp:speedtest.sctelcom.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15410 accepted tcp:speedtest.us-la.kamatera.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15394 accepted tcp:speedtest.rd.ks.cox.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15422 accepted tcp:speedtest-wichita.kanren.net.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15430 accepted tcp:speedtest2.ideatek.com:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:57 127.0.0.1:15434 accepted tcp:speedtest.homecomminc.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:27:58 127.0.0.1:15458 accepted tcp:clients4.google.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIREC

And here is the log of 1.8.16:

2024/07/16 21:37:33 86.57...:0 accepted tcp:www.speedtest.net:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:i.pcmag.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:i.pcmag.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:i.pcmag.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:i.pcmag.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:i.pcmag.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:i.pcmag.com:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:33 86.57...:0 accepted tcp:www.speedtest.net:443 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:34 127.0.0.1:16244 accepted tcp:127.0.0.1:0 [api -> api]
2024/07/16 21:37:35 86.57...:0 accepted tcp:speedtest.mtc4me.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:36 86.57...:0 accepted tcp:speedtest.homecomminc.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:36 86.57...:0 accepted tcp:speedtest.rd.ks.cox.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT
2024/07/16 21:37:37 86.57...:0 accepted tcp:speedtest.us-west-02.lunavi.com.prod.hosts.ooklaserver.net:8080 [inbound-127.0.0.1:2090 >> direct] email: M.DIRECT

MEM-917 avatar Jul 17 '24 01:07 MEM-917

what are you using to pass source ip, proxy protocol? or X-Forwarded-For?

Fangliding avatar Jul 17 '24 02:07 Fangliding

what are you using to pass source ip, proxy protocol? or X-Forwarded-For?

I use X-Forward-For because by using"proxy_protocol", the real IP of the client behind CF cdn can't be obtained with gRPC protocol.

MEM-917 avatar Jul 17 '24 02:07 MEM-917

It seems that a small change in WS has break it, we will fix it

Fangliding avatar Jul 17 '24 03:07 Fangliding

Try https://github.com/XTLS/Xray-core/actions/runs/9967617597 ?

Fangliding avatar Jul 17 '24 03:07 Fangliding

Thanks, I'll try it now and will let you know.

EDIT: It works like a charm. Thanks, man.

MEM-917 avatar Jul 17 '24 10:07 MEM-917