Apache 2.4 websocket configuration


Apache 2.4 has support for websocket using proxy configuration using module mod_proxy_wstunnel.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

User needs to remove # comment for  proxy related modules like

please un comment
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

backend.server.com is backend server name

Configure proxy and passpass rules 

ProxyPass        /    ws://backend.server.com:8080/
ProxyPassReverse /    ws://backend.server.com:8080/
ProxyPass        /    wss://backend.server.com:8080/
ProxyPassReverse /    wss://backend.server.com:8080/
ProxyPass        /  http://backend.server.com:8080/
ProxyPassReverse /  http://backend.server.com:8080/


Order of this module is imported.

If modules are loaded sucessfully.  following lines are seen in Apache httpd trace log server

 [proxy:debug] [pid :tid 4] proxy_util.c(1777): AH00925: initializing worker ws://backend.server.com:8080/ shared
 [proxy:debug] [pid :tid 4] proxy_util.c(1819): AH00927: initializing worker ws://backend.server.com:8080/ local
 [proxy:debug] [pid :tid 4] proxy_util.c(1853): AH00930: initialized pool in child 916 for (backend.server.com) min=0 max=64 smax=64
 [proxy:debug] [pid :tid 4] proxy_util.c(1777): AH00925: initializing worker wss://backend.server.com:8080/ shared
 [proxy:debug] [pid :tid 4] proxy_util.c(1819): AH00927: initializing worker wss://backend.server.com:8080/ local
 [proxy:debug] [pid :tid 4] proxy_util.c(1853): AH00930: initialized pool in child 916 for (backend.server.com) min=0 max=64 smax=64
 [proxy:debug] [pid :tid 4] proxy_util.c(1777): AH00925: initializing worker http://backend.server.com:8080/ shared
 [proxy:debug] [pid :tid 4] proxy_util.c(1819): AH00927: initializing worker http://backend.server.com:8080/ local
 [proxy:debug] [pid :tid 4] proxy_util.c(1853): AH00930: initialized pool in child 916 for (backend.server.com) min=0 max=64 smax=64
 [proxy:debug] [pid :tid 4] proxy_util.c(1777): AH00925: initializing worker proxy:reverse shared
 [proxy:debug] [pid :tid 4] proxy_util.c(1819): AH00927: initializing worker proxy:reverse local

No comments:

Post a Comment