Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not sure what to call it (proxy/redirection/relay), and I am hoping some software or solution possibly exists for linux.

My intention is to be able to listen on a single public facing ip:port (specifically port 80) and proxy(?) traffic to internal servers each running unique application instances. The data in the TCP connection would be used to determine which internal server to go to, i.e. a distinct instance is meant to be connected to. Which is going to require some form of level7 parsing of the application data, and from that proxy(?) to the correct endpoint.

I am not looking to load balance. Though I have been researching haproxy and similar software to try and better understand my problem. What haproxy does in terms of "proxying" http traffic using information in the http header to determine which internal server to load balance to is very similar to what I would like to do. Which is sort of the problem as searching for this I continually end up in finding something that only parses HTTP tcp traffic, but I need something more generic. Or maybe this is even possible with haproxy, but I didn't see anything that indicated that.

The application protocol I would specifically be working with is Union, and it works over a single port so it should be relayable. And the intention again is to allow multiple instances of union to all listen on the public facing port 80, though each will of course be listening to an internal address/port.

Does this make any sense to anyone? Or am I totally on the wrong track for what I would like to do. Since there are so many load balancers which can work with any TCP related protocol, I would imagine someone has possibly made something with l7 filtering and just ignored the load balancing bit.

share|improve this question
1  
Does the Union protocol itself have provisions for a client to tell which server to redirect to (like HTTP "Host: ..." header), or are you planning to add an additional layer over the protocol? –  grawity Jul 7 '11 at 22:29
    
No it does not. I am trying to work around the protocol itself to make this possible. If encapsulating the union protocol within another minute protocol (handled by the proxy) will work though, that's the ticket I am looking for. –  Nicholi Jul 7 '11 at 22:46
    
Actually nevermind what I said previously, what if the protocol did have a header similar to HTTP's for redirection? Is there something already out there for that? –  Nicholi Jul 8 '11 at 16:07
1  
Not for Unity specifically, only for HTTP as far as I know. If such a header was part of the official protocol, it would make it unnecessary to modify client software, and the proxy would be relatively easy to write (Unity seems to be using XML). –  grawity Jul 8 '11 at 16:52
    
I am in contact with their developers so this may be possible. Is there any particular opensource proxy project I should possibly use as a starting point? Or completely write from scratch? –  Nicholi Jul 8 '11 at 17:00

3 Answers 3

Sounds very complicated. I'd rather recommend using a VPN software like OpenVPN. Simpler to set up and use. You can use Port 80 TCP for OpenVPN connections.

share|improve this answer

If you are okay with exposing the internal hostnames or IP addresses of your servers, a simple HTTP CONNECT proxy would work:

==> (connected to <proxyhost>:80)
--> CONNECT server42:<port> HTTP/1.0
--> Host: <proxyhost>
--> 
<-- HTTP/1.0 200 Connection Established
<-- Proxy-agent: Apache/2.2.19 (Debian)
<-- 
--> (client sends Union handshake as usual)

Similar protocols are SOCKS 5 (slightly more complicated) and TCPMUX (probably the simplest to implement; use xinetd for the proxy). All three will likely require modifications of your client program.

share|improve this answer
    
TCPMUX does sound very simple and possibly quite useful in this situation, will be checking it out. –  Nicholi Jul 8 '11 at 17:02
up vote 0 down vote accepted

The solution I was looking into, but never got around to completing, was using Apache Traffic Server. It contains a framework in order to build plugins for any protocol going over TCP and proxy the traffic as you desire. Their example "protocol" plugin is a good primer to see exactly how you could easily wrap your protocol within another specifically for reverse proxying. If anyone were looking for a similar solution, I would recommend this (however will require development work as, it is all built in C).

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.