Obtain the client IP over the proxy

Post Reply
owlboo98
Posts: 15
Joined: Tue Apr 20, 2021 8:11 am

Obtain the client IP over the proxy

Post by owlboo98 » Thu Apr 13, 2023 6:45 am

Hi,
How can I obtain the client Ip if my SMPP Servers runs under the proxy?
_client.RemoteEndPoint is obtaining the proxy IP.
alt
Site Admin
Posts: 988
Joined: Tue Apr 25, 2006 9:45 am

Re: Obtain the client IP over the proxy

Post by alt » Fri Apr 14, 2023 10:13 am

Does the Proxy supports Proxy protocol https://www.haproxy.com/blog/haproxy/proxy-protocol/ ?
didimo
Posts: 8
Joined: Thu Jan 23, 2014 9:23 pm

Re: Obtain the client IP over the proxy

Post by didimo » Tue Apr 09, 2024 3:01 pm

alt wrote:
Fri Apr 14, 2023 10:13 am
Does the Proxy supports Proxy protocol https://www.haproxy.com/blog/haproxy/proxy-protocol/ ?
Hello alt,

We are in the same situation as owlboo98. Our SMPPserver solution is deployed with HAProxy and proxy protocol enabled. Our goal is also obtain source IP without NAT (transparent IP) and without use TPROXY at HAProxy.
When trying to connect using SMPPClient with SSL, SMPP_server service is returning Generic_nack, Status: "Command length is invalid"

Should we change something in SMPP_server code to support proxy-protocol or other related feature to obtain source IP address?

Thanks in advance for your help.
Attachments
SMPP_wireshark.png
SMPP_wireshark
SMPP_wireshark.png (196.3 KiB) Viewed 6228 times
alt
Site Admin
Posts: 988
Joined: Tue Apr 25, 2006 9:45 am

Re: Obtain the client IP over the proxy

Post by alt » Wed Apr 24, 2024 4:47 pm

You need to enable ProxyProtocolEnabled for the client in the handler method for the event evClientConnected

Code: Select all

 smppServer.evClientConnected += (sender, client) =>
 {
     client.ProxyProtocolEnabled = true;
 };
 
after that the RemoteEndPoint of the client returns the IP address behind the proxy.
Post Reply