1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<modulesynopsis metafile="mod_proxy_wstunnel.xml.meta">
<name>mod_proxy_wstunnel</name>
<description>Websockets support module for
<module>mod_proxy</module></description>
<status>Extension</status>
<sourcefile>mod_proxy_wstunnel.c</sourcefile>
<identifier>proxy_wstunnel_module</identifier>
<compatibility>Available in httpd 2.4.5 and later</compatibility>
<summary>
<p>This module <em>requires</em> the service of <module
>mod_proxy</module>. It provides support for the tunnelling of web
socket connections to a backend websockets server. The connection
is automatically upgraded to a websocket connection:</p>
<example><title>HTTP Response</title>
<highlight language="config">
Upgrade: WebSocket
Connection: Upgrade
</highlight>
</example>
<p>Proxying requests to a websockets server like <code>echo.websocket.org</code> can be done using the
<directive type="ProxyPass" module="mod_proxy">ProxyPass</directive> directive:</p>
<highlight language="config">
ProxyPass "/ws2/" "ws://echo.websocket.org/"
ProxyPass "/wss2/" "wss://echo.websocket.org/"
</highlight>
<p>Proxying both HTTP and websockets at the same time can be done by specifying the websockets
<directive type="ProxyPass" module="mod_proxy">ProxyPass</directive> directive before the
HTTP directive:</p>
<highlight language="config">
ProxyPass "/" "ws://backend.example.com:9080/"
ProxyPass "/" "http://backend.example.com:9080/"
</highlight>
<p>Load balancing for multiple backends can be achieved using <module>mod_proxy_balancer</module>.</p>
<p>In fact the module can be used to upgrade to other protocols, you can set the <code>upgrade</code>
parameter in the <directive type="ProxyPass" module="mod_proxy">ProxyPass</directive>
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 <code>Upgrade</code> will read in the request headers and use
in the response <code>Upgrade</code></p>
</summary>
<seealso><module>mod_proxy</module></seealso>
<directivesynopsis>
<name>ProxyWebsocketFallbackToProxyHttp</name>
<description>Instructs this module to let <module>mod_proxy_http</module> handle the request</description>
<syntax>ProxyWebsocketFallbackToProxyHttp On|Off</syntax>
<default>ProxyWebsocketFallbackToProxyHttp On</default>
<contextlist><context>server config</context>
<context>virtual host</context>
</contextlist>
<compatibility>Available in httpd 2.4.48 and later</compatibility>
<usage>
<p>Since httpd 2.4.47, <module>mod_proxy_http</module> can handle WebSocket
upgrading and tunneling in accordance to RFC 7230, this directive controls
whether <module>mod_proxy_wstunnel</module> should hand over to
<module>mod_proxy_http</module> to this, which is the case by default.</p>
<p>Setting to <em>Off</em> lets <module>mod_proxy_wstunnel</module> handle
WebSocket requests as in httpd 2.4.46 and earlier.</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ProxyWebsocketAsync</name>
<description>Instructs this module to try to create an asynchronous tunnel</description>
<syntax>ProxyWebsocketAsync ON|OFF</syntax>
<contextlist><context>server config</context>
<context>virtual host</context>
</contextlist>
<usage>
<p>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.</p>
<note><title>Note</title><p>Async support is experimental and subject
to change.</p></note>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ProxyWebsocketIdleTimeout</name>
<description>Sets the maximum amount of time to wait for data on the websockets tunnel</description>
<syntax>ProxyWebsocketIdleTimeout <var>num</var>[ms]</syntax>
<default>ProxyWebsocketIdleTimeout 0</default>
<contextlist><context>server config</context>
<context>virtual host</context>
</contextlist>
<usage>
<p>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 <em>ms</em> suffix.</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ProxyWebsocketAsyncDelay</name>
<description>Sets the amount of time the tunnel waits synchronously for data</description>
<syntax>ProxyWebsocketAsyncDelay <var>num</var>[ms]</syntax>
<default>ProxyWebsocketAsyncDelay 0</default>
<contextlist><context>server config</context>
<context>virtual host</context>
</contextlist>
<usage>
<p>If <directive>ProxyWebsocketAsync</directive> 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 <em>ms</em> suffix.</p>
<note><title>Note</title><p>Async support is experimental and subject
to change. </p></note>
</usage>
</directivesynopsis>
</modulesynopsis>
|