@@ -22,6 +22,8 @@ set -o pipefail
22
22
# ## conf:phpfpm:tcp:<host>:<port> # Remote PHP-FPM server at <host>:<port>
23
23
# ## conf:rproxy:http:<host>:<port> # Reverse Proxy server at http://<host>:<port>
24
24
# ## conf:rproxy:https:<host>:<port> # Reverse Proxy server at https://<host>:<port>
25
+ # ## conf:rproxy:ws:<host>:<port> # Reverse Proxy (websocket) at ws://<host>:<port>
26
+ # ## conf:rproxy:wss:<host>:<port> # Reverse Proxy (websocket) at wss://<host>:<port>
25
27
# ##
26
28
# ##
27
29
# ## Format-2: file:<file>
@@ -40,6 +42,8 @@ set -o pipefail
40
42
# ## Examples:
41
43
# ## conf:rproxy:http:10.0.0.1:3000
42
44
# ## conf:rproxy:https:mydomain.com:8080
45
+ # ## conf:rproxy:ws:10.0.0.1:3000
46
+ # ## conf:rproxy:wss:10.0.0.1:3000
43
47
# ##
44
48
# ## Note: If no file is found, a warning will be logged and no Reverse proxy will be created.
45
49
# ##
@@ -90,7 +94,13 @@ backend_conf_is_valid() {
90
94
fi
91
95
# 3. Protocol: 'tcp', 'http' or 'https'
92
96
if ! backend_is_valid_conf_prot " ${1} " ; then
93
- echo " Invalid backend conf:<prot> in: '${1} '. It must be 'tcp', 'http' or 'https'"
97
+ # Apache 2.2 does not have websocket support
98
+ if [ " ${VHOSTGEN_HTTPD_SERVER} " = " apache22" ]; then
99
+ echo " Invalid backend conf:<prot> in: '${1} '. It must be 'tcp', 'http' or 'https'."
100
+ # All other webserver have websocket support
101
+ else
102
+ echo " Invalid backend conf:<prot> in: '${1} '. It must be 'tcp', 'http', 'https', 'ws' or 'wss'."
103
+ fi
94
104
return 1
95
105
fi
96
106
# 4. Host
@@ -116,9 +126,22 @@ backend_conf_is_valid() {
116
126
fi
117
127
# 7. Validate conf <protocol> rproxy == http(s)?
118
128
if [ " ${backend_conf_type} " = " rproxy" ]; then
119
- if [ " ${backend_conf_prot} " != " http" ] && [ " ${backend_conf_prot} " != " https" ]; then
120
- echo " Invalid backend conf:<prot> in: '${1} '. 'rproxy' only supports 'http' or 'https'"
121
- return 1
129
+ # Apache 2.2 does not have websocket support
130
+ if [ " ${VHOSTGEN_HTTPD_SERVER} " = " apache22" ]; then
131
+ if [ " ${backend_conf_prot} " != " http" ] \
132
+ && [ " ${backend_conf_prot} " != " https" ]; then
133
+ echo " Invalid backend conf:<prot> in: '${1} '. 'rproxy' only supports 'http' and 'https'"
134
+ return 1
135
+ fi
136
+ # All other webserver have websocket support
137
+ else
138
+ if [ " ${backend_conf_prot} " != " http" ] \
139
+ && [ " ${backend_conf_prot} " != " https" ] \
140
+ && [ " ${backend_conf_prot} " != " ws" ] \
141
+ && [ " ${backend_conf_prot} " != " wss" ]; then
142
+ echo " Invalid backend conf:<prot> in: '${1} '. 'rproxy' only supports 'http', 'https', 'ws' and 'wss'"
143
+ return 1
144
+ fi
122
145
fi
123
146
fi
124
147
}
@@ -181,8 +204,14 @@ backend_is_valid_conf_prot() {
181
204
local value
182
205
value=" $( get_backend_conf_prot " ${1} " ) "
183
206
184
- if [ " ${value} " != " tcp" ] && [ " ${value} " != " http" ] && [ " ${value} " != " https" ]; then
185
- return 1
207
+ if [ " ${VHOSTGEN_HTTPD_SERVER} " = " apache22" ]; then
208
+ if [ " ${value} " != " tcp" ] && [ " ${value} " != " http" ] && [ " ${value} " != " https" ]; then
209
+ return 1
210
+ fi
211
+ else
212
+ if [ " ${value} " != " tcp" ] && [ " ${value} " != " http" ] && [ " ${value} " != " https" ] && [ " ${value} " != " ws" ] && [ " ${value} " != " wss" ]; then
213
+ return 1
214
+ fi
186
215
fi
187
216
return 0
188
217
}
0 commit comments