mod_proxy_wstunnel
Websockets support module for mod_proxy
Extension
mod_proxy_wstunnel.c
proxy_wstunnel_module
Available in httpd 2.4.5 and later

This module requires the service of mod_proxy. It provides support for the tunnelling of web socket connections to a backend websockets server. The connection is automatically upgraded to a websocket connection:

# HTTP Response

Upgrade: WebSocket Connection: Upgrade

Proxying requests to a websockets server like `echo.websocket.org` can be done using the ProxyPass directive:

ProxyPass "/ws2/" "ws://echo.websocket.org/" ProxyPass "/wss2/" "wss://echo.websocket.org/"

Load balancing for multiple backends can be achieved using mod_proxy_balancer.

mod_proxy
ProxyWebsocketAsync
Instructs this module to try to create an asynchronous tunnel
ProxyWebsocketAsync ON|OFF
server config
virtual host

This directive instructs the server to try to create an asynchronous tunnel. If the current MPM does not support the necessary features, a synchronous tunnel is used.

# Note

Async support is experimental and subject to change.

ProxyWebsocketIdleTimeout
Sets the maximum amount of time to wait for data on the websockets tunnel
ProxyWebsocketIdleTimeout num[ms]
ProxyWebsocketIdleTimeout 0
server config
virtual host

This directive imposes a maximum amount of time for the tunnel to be left open while idle.

ProxyWebsocketAsyncDelay
Sets the amount of time the tunnel waits synchronously for data
ProxyWebsocketAsyncDelay num[ms]
ProxyWebsocketAsyncDelay 0
server config
virtual host

If ProxyWebsocketAsync is enabled, this directive controls how long the server synchronously waits for more data.

# Note

Async support is experimental and subject to change.