I was wondering if it’s possible to retain an in incoming connection’s public IP to the TCP stream that’s going to be routed to a backend server.
This should apply to the situation that you guys helped me resolve here:
The backend server is FIX server, so doesn’t know PROXY protocol.
My ultimate goal would be adding the incoming client’s source IP address (which is known by the proxy) to the first incoming message when the connection is established. First message in FIX would be always login, and I would like to add the source IP address delimited by \n in front of the login message (in other words adding a header to a plain TCP text message like FIX logon). The backend’s parser would take care of the rest extracting this info and doing whatever is needed with it. Also this is preferably only needed once when the connection is first established.
Is this possible to achieve with HAProxy?
Concrete example of FIX login message that’s incoming:
8=FIX.4.4|9=126|35=A|49=theBroker.12345|56=CSERVER|34=1|52=20170117- 08:03:04|57=TRADE|50=any_string|98=0|108=30|141=Y|553=12345|554=passw0rd!|10=131|
I want to alter it by appending the following header to it (using haproxy.org’s IP in the example):
51.15.8.218
8=FIX.4.4|9=126|35=A|49=theBroker.12345|56=CSERVER|34=1|52=20170117- 08:03:04|57=TRADE|50=any_string|98=0|108=30|141=Y|553=12345|554=passw0rd!|10=131|
Any other delimiter would be acceptable not only \n, we could also get by adding a fixed length string in front of the message and eliminate it later in the backend (like in the below example IP would reserve xxx.xxx.xxx.xxx - 19 bytes to have headroom to store any IPv4 address in the message):
51.15.8.218 8=FIX.4.4|9=126|35=A|49=theBroker.12345|56=CSERVER|34=1|52=20170117- 08:03:04|57=TRADE|50=any_string|98=0|108=30|141=Y|553=12345|554=passw0rd!|10=131|