简体   繁体   中英

Play framework: Secure WebSocket with Apache

Play 2 framework does not support Secure WebSocket. So I use nginx as a proxy to work as a SSL endpoint for WSS connection (as suggested in the post How to use TLS in Play!Framework WebSockets ("wss://") ). Everything works with nginx. Do you know if this is possible also with Apache HTTP Server? How should I change the httpd.conf to have Apache as a SSL endpoint for WSS?

What makes you think Play doesn't support secure websocket? It does, secure websockets is just the regular websocket protocol over https instead of HTTP. Just enable https, and there you have it, secure websocket support.

You can proxy websockets in Apache using this:

https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

But you'd be crazy to do so, Apache uses a thread per connection, and websockets uses persistent connections, using a whole thread per connection when you're expecting a lot of them is a waste of resources, a non blocking proxy like nginx makes a lot more sense.

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