@@ -22,6 +22,8 @@ set -o pipefail
2222# ## conf:phpfpm:tcp:<host>:<port> # Remote PHP-FPM server at <host>:<port>
2323# ## conf:rproxy:http:<host>:<port> # Reverse Proxy server at http://<host>:<port>
2424# ## 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>
2527# ##
2628# ##
2729# ## Format-2: file:<file>
@@ -40,6 +42,8 @@ set -o pipefail
4042# ## Examples:
4143# ## conf:rproxy:http:10.0.0.1:3000
4244# ## conf:rproxy:https:mydomain.com:8080
45+ # ## conf:rproxy:ws:10.0.0.1:3000
46+ # ## conf:rproxy:wss:10.0.0.1:3000
4347# ##
4448# ## Note: If no file is found, a warning will be logged and no Reverse proxy will be created.
4549# ##
@@ -90,7 +94,13 @@ backend_conf_is_valid() {
9094 fi
9195 # 3. Protocol: 'tcp', 'http' or 'https'
9296 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
94104 return 1
95105 fi
96106 # 4. Host
@@ -116,9 +126,22 @@ backend_conf_is_valid() {
116126 fi
117127 # 7. Validate conf <protocol> rproxy == http(s)?
118128 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
122145 fi
123146 fi
124147}
@@ -181,8 +204,14 @@ backend_is_valid_conf_prot() {
181204 local value
182205 value=" $( get_backend_conf_prot " ${1} " ) "
183206
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
186215 fi
187216 return 0
188217}
0 commit comments