简体   繁体   English

播放框架:使用Apache的安全WebSocket

[英]Play framework: Secure WebSocket with Apache

Play 2 framework does not support Secure WebSocket. Play 2框架不支持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://") ). 因此,我使用nginx作为代理来充当WSS连接的SSL端点(如“ 如何在Play!Framework WebSockets(“ wss://”) )中使用TLS一文中所建议。 Everything works with nginx. 一切都适用于Nginx。 Do you know if this is possible also with Apache HTTP Server? 您知道Apache HTTP Server是否也可以做到吗? How should I change the httpd.conf to have Apache as a SSL endpoint for WSS? 我应该如何更改httpd.conf以将Apache作为WSS的SSL端点?

What makes you think Play doesn't support secure websocket? 是什么让您认为Play不支持安全网络套接字? It does, secure websockets is just the regular websocket protocol over https instead of HTTP. 确实如此,安全的websockets只是通过https而不是HTTP的常规websocket协议。 Just enable https, and there you have it, secure websocket support. 只需启用https,即可获得安全的websocket支持。

You can proxy websockets in Apache using this: 您可以使用以下命令在Apache中代理websocket:

https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html 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. 但是您这样做会很疯狂,Apache每个连接使用一个线程,而websockets使用持久连接,当您期望很多连接浪费资源时,每个连接使用整个线程,像nginx这样的非阻塞代理更有意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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