<-
Apache > HTTP Server > Documentation > Version 2.5 > Modules

Apache Module mod_proxy_wstunnel

Available Languages:  en 

Description:Websockets support module for mod_proxy
Status:Extension
Module Identifier:proxy_wstunnel_module
Source File:mod_proxy_wstunnel.c
Compatibility:Available in httpd 2.4.5 and later

Summary

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.

In fact the module can be used to upgrade to other protocols, you can set the upgrade parameter in the ProxyPass directive to allow the module to accept other protocol. NONE means you bypass the check for the header but still upgrade to WebSocket. ANY means that Upgrade will read in the request headers and use in the response Upgrade

Directives

Bugfix checklist

See also

top

ProxyWebsocketAsync Directive

Description:Instructs this module to try to create an asynchronous tunnel
Syntax:ProxyWebsocketAsync ON|OFF
Context:server config, virtual host
Status:Extension
Module:mod_proxy_wstunnel

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.

top

ProxyWebsocketAsyncDelay Directive

Description:Sets the amount of time the tunnel waits synchronously for data
Syntax:ProxyWebsocketAsyncDelay num[ms]
Default:ProxyWebsocketAsyncDelay 0
Context:server config, virtual host
Status:Extension
Module:mod_proxy_wstunnel

If ProxyWebsocketAsync is enabled, this directive controls how long the server synchronously waits for more data. The timeout is considered in seconds by default, but it is possible to increase the time resolution to milliseconds adding the ms suffix.

Note

Async support is experimental and subject to change.

top

ProxyWebsocketIdleTimeout Directive

Description:Sets the maximum amount of time to wait for data on the websockets tunnel
Syntax:ProxyWebsocketIdleTimeout num[ms]
Default:ProxyWebsocketIdleTimeout 0
Context:server config, virtual host
Status:Extension
Module:mod_proxy_wstunnel

This directive imposes a maximum amount of time for the tunnel to be left open while idle. The timeout is considered in seconds by default, but it is possible to increase the time resolution to milliseconds adding the ms suffix.

Available Languages:  en 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.