Peerjs server and ProxyPass Apache

662 views
Skip to first unread message

Orfeo Morello

unread,
Oct 31, 2014, 12:32:22 PM10/31/14
to pee...@googlegroups.com
Hello, 
I will try to briefly explain my problem in the hope that someone can give a suggestion.

I have successfully installed the Peerjs server on my ip address

xxx.xxx.xxx.xxx:9001 and it is accessible with https://mywebsite:9001/

Now i not want to use the 9001 port because some network are blocking port 9001 and i can not use port 80 because there is Apache running.

So I thought I'd find a solution using Apache 2.4 ProxyPass Configuration and mod_proxy_wstunnel

The Peerjs server needs some requests to be proxied through as HTTP, but others to use the websockets protocol and they are using the same URI PATH.

and
ws://mywebsite:9001/peerjs?key=peerjs&id=xxxxxxxxx&token=xxxxxxxx

I can not structure the ProxyPass Apache directive to catch the right path because they are equal for both protocols. Can i edit Peerjs server to have different URL for each protocol? I need a different URL for http:// and ws:// 

For example

and
ws://mywebsite:9001/otherurl?key=peerjs&id=xxxxxxxxx&token=xxxxxxxx

Thanks in advance for your answers

Michelle Bu

unread,
Nov 1, 2014, 3:28:03 PM11/1/14
to Orfeo Morello, peerjs
https://github.com/peers/peerjs/issues/251

Would this solve your issue?
Michelle

Orfeo Morello

unread,
Nov 2, 2014, 1:46:24 AM11/2/14
to pee...@googlegroups.com, orfeom...@gmail.com, miche...@berkeley.edu
I think it will solve the problem.

This problem is similar to what happened a few months ago with socket.io library

Andy

unread,
Dec 9, 2014, 9:13:50 AM12/9/14
to pee...@googlegroups.com, orfeom...@gmail.com, miche...@berkeley.edu
I'd like it too... in Apache I need something like:

        ProxyPreserveHost On

        ProxyPass /peer/ws/ ws://<PEERSERVER>:<PORT>/peer/ws
        ProxyPassReverse /peer/ws/ ws://<PEERSERVER>:<PORT>/peer/ws

        ProxyPass /peer/http/ http://<PEERSERVER>:<PORT>/peer/ws
        ProxyPassReverse /peer/http/ http://<PEERSERVER>:<PORT>/peer/ws

any suggestion?



Presently I'm thinking of (yet to be tested, just generic idea) changing on client-side...

        this._httpUrl = httpProtocol + host + ':' + port + path +'/http' + key;
        this._wsUrl = wsProtocol + host + ':' + port + path +'/ws' + 'peerjs?key=' + key;


...and on server-side:
        all occurences of '/:key/' in routes to '/:key/:scheme/'



But I need a more robust solution, not forking scripts.
Reply all
Reply to author
Forward
0 new messages