Based on the expert recommendation of the IANA, the WebSocket protocol by default uses port 80 for regular WebSocket connections.
How can I make my websocket listen to port 80 when the Apache server is already listening to this port?
I made it works when my WebSocket were using port 12345 but I do not want to open to everyone that port and IANA recommend port 80... but I do not get how to make it works with that port?
I have read that for Jabber server that you can use Apache to redirect the call. Here is an example from this website :
<VirtualHost *:80>
Servername yourdomain.com
DocumentRoot /var/www
AddDefaultCharset UTF-8
RewriteEngine On
RewriteRule ^/http-bind/ http://jabber.yourdomain.com:5280/http-bind/ [P]
</VirtualHost>
Maybe I can do something like that with the websocket... what is your thought?
You don't. The rule, in every OS I know of, is one process, one port. And that makes sense. If you have two processes listening to the same port, then who is to say which one should handle it? You'll have to expose some other port on that machine.
The websocket protocol uses port 80 (HTTP) or 443 (HTTPS). What we've done is use port 80 for our webserver and port 443 for the websocket. This prevents the clash but still follows the standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With