Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a haproxy configuration run in http mode. I pass requests to backend java servers. I use forwardfor option to get client ip in backend server. I want to get source port in backend server but there isn't any option about this in haproxy conf.

From maillist, i learnt, proxy protocol can be used for this. But i couldn't find any document or how-to about implementation of proxy protocol.

Can i pass source port information to backend server only changing load balancer configuration?

share|improve this question
Why do you need this? Source ports are generated randomly and usually they don't have any special meaning! –  Khaled Dec 27 '11 at 12:53
How do you expect this information to be relayed to the backend server? –  Shane Madden Dec 27 '11 at 16:17
My customer wants this information. Actually, i don't know for what they will use it. They said, it is related with NAT. They want to get source port information as a HTTP header. –  dirigeant Dec 28 '11 at 1:21
You can try something like reqadd X-SPort:\ src_port but I don't think it will work. I agree with @Khaled, there is no use to this info, since the backend is sending data to haproxy, and not to the client. Maybe if you are using TProxy... –  Marcelo Bittencourt Dec 29 '11 at 6:00
@MarceloBittencourt i tried it but it didn't work. Client says the api which they use for authenticate mobile phones will use it for user identification. –  dirigeant Jan 3 '12 at 21:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.