简体   繁体   中英

Is it possible to run a webserver and socket.io all on one secure port?

I have an Apache webserver serving pages on port 443 and socket.io responding on port 8888.

Is there any way to have just the secure port (443) handle everything (ie webpages and socket.io) and close everything else?

Many of my customers will only have ports 80 and 443 available to them. I don't want to send insecure data over port 80.

You could use apache to listen on 443 and "reverse" proxy requests to socket.io on port 8888 based on an url.

Similar questions were already asked here: Apache, NodeJS and socket.io: Use Apache or NodeJS as Reverse-Proxy? , http://www.apachetutor.org/admin/reverseproxies and http://www.microhowto.info/howto/configure_apache_as_a_reverse_proxy.html

Official apache documentation is here: https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassreverse

看起来mod_proxy_wstunnel可能会满足您的要求:

ProxyPass /wss2/ ws://localhost:8888/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM