I am using open source streaming server Red5 on multiple servers. Which are running behind a bastion host.

the world knows these sites as


To reach the front end server is using Apache Reverse Proxy.

I am also having video streaming on each of these websites using rtmp.

To be able to reach the streaming server I embed a javascript in HTML pages as follows Code:

<embed .....

the problem is the website are many


each on a separate physical server. Each of these four have their own Red5 installations the front end to each of these four is a common Bastion Host.

If I run rtmp on each of the subdomains at a different port

how will I make sure a request such as


goes to their respective servers. from the front end server. What do I need to handle in this case ?

IPTABLES came to mind instantly but from the client browser on internet when some one requests


how will I make sure this rtmp request is mapped to a port different than 1935 as there are three other streaming servers which are also to respond to their respective requests ?


If your users are only contacting the rtmp servers via the code (as opposed to typing in the URL manually themselves, you can simply specify the proper port number in the URL itself.

For exmaple:


Attempting to do such a redirection via iptables is non-trivial. The TCP/IP headers which iptables works with contain no trace of the DNS lookup that was done to arrive at the IP address contained within the headers.

Depending on the protocol format of RTMP (which I'm not familiar with), you may be able to something like the l7-filter project to create filter rules that inspect the payload. However, note that it's not part of the standard Linux kernel, requiring you to patch and roll your own.

  • I understand your solution some how we have that precision to use it on 1935. Also all these websites are not Load Balancing websites they are different ones.I came across some thing known as Layer 7 firewall for this scenario. I am using Linux for that can you suggest some thing. So that based on hostname part the URL could be redirected to different places by gateway. – Bond Aug 10 '10 at 1:37
  • In the last paragraph of my answer I mentioned and linked to the l7-filter project. That project provides the "layer 7 firewall" functionality you're inquiring about. I still think the simplest solution is to include the ports in the URL within the Javascript code. Is there some reason you can't specify the port in your code? You said yourself that each service is running on a different port. ("If I run rtmp on each of the subdomains at a different port.") – chuckx Aug 10 '10 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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