[erlang-questions] Handling non http in mochiweb

ori brost <>
Thu Aug 18 17:14:53 CEST 2011


I will describe my exact problem, maybe there are other solutions i
did not think of.
Our program provides a websocket service over a port. We wish to allow
people without a websocket supporting browser to use it so we use a
flash object to do websocket when the browser can't. In order for this
to work, the flash object needs to get a flash policy file. Flash
forces the file to be in one of two places:
- port 843 (flash hard coded)
- the port of the ws service
Note that the flash protocol is NOT HTTP based.
Originally we worked with 843, but we then decided to put out server
behind an Amazon ELB. Amazon ELB does not allow port forwarding for
ports below 1024 which are not 80 or 443, so our only choice was to
implement the flash policy file server in the same port via a patch to
mochiweb (https://github.com/nivertech/mochiweb/tree/ori_flash_170811).
We also thought of putting the websocket service behind an haproxy
instead of ELB, but ELB is better because it is also hardware based
unlike haproxy which is only software.

Do you see any other solution for this?

2011/8/17 Motiejus Jakštys <>:
> On Tue, Aug 16, 2011 at 02:45:03PM -0700, Ryan Huffman wrote:
>> Does it have to be the same port?  You could use gen_tcp to listen to
>> connections on a different port and handle the traffic however you would
>> like.
>>
>
> Sometimes people are forced to use http proxy for http traffic (80 and
> 443) (an example is university of Glasgow), therefore you can't send
> arbitrary traffic through port 80 -- it just doesn't work.
>
> However, you can use port 443 for arbitrary TCP and be quite sure it
> will work anywhere. (I used openvpn over tcp 443)
>
> Motiejus
>



More information about the erlang-questions mailing list