Open rere16 opened 10 years ago
@rere16 you also have to proxy the web requests in the proxyServer
as websockets is initialized by a couple POST requests iirc
Thank you very much for your answer. But, I have no idea how to do this. Please, could you give me a short example ?
Thanks
@rere16 well lets start with why do you want to proxy the websocket connection to another server when you already have an http server that you can then attach the websocket server to as well?
Because I developed an application using websocket (port 8080) and I would like that this application communicates with the client through the webserver (port 80). By proxing, only the port 80 is open. The port 8080 is local. (The webserver and the application is on the same machine)
@rere16 ahh ok, I guess my argument is why are they two separate applications? The tricky part here is that you will have to custom proxy based on the particular requests that initialize the websocket connection.
There are two applications because one is an application written in C++ using websocket and the other is the webserver (nodejs). I just want to redirect the websocket stream between the client and the application (no cache). It's a routing proxy feature.
For example with apache (port 80)
Location /ws ProxyPass ws://127.0.0.1:8080 ProxyPassReverse ws://127.0.0.1:8080 Location
The request ws://127.0.0.1:80/ws will be redirect to ws://127.0.0.1:8080/ws.
Thx
@rere16 I am also in this situation. I have websocket server written in c++ and generating some data and I want to use node-http-proxy. I am wondering whether you are able to find the solution for this or not.
Please let me know if you did this already Thanks
Did some one find the solution for this problem?
+1
The javascript source code in my first message works. I had an issue in my C++ program.
Hello,
I am using node-http-proxy to route websocket from port 80 to port 8080. I have a http server (port 80). I would like to create a websocket connection between the client and the server through the nodejs server. I use the following source code :
But, the server only receives the handshake message and the connection closes (eof). I tested with apache and proxy_mod, the server works fine.
Any idea ?
Thank you very much.