From be4aa6149b39a54014c811462ae9b6d92d54e5bf Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Sun, 9 Aug 2020 19:11:11 +0000 Subject: [PATCH] add 2.4 examples of mixed http/ws git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1880722 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/mod_proxy_wstunnel.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/manual/mod/mod_proxy_wstunnel.xml b/docs/manual/mod/mod_proxy_wstunnel.xml index 4d46e5bf8b7..e36eb328904 100644 --- a/docs/manual/mod/mod_proxy_wstunnel.xml +++ b/docs/manual/mod/mod_proxy_wstunnel.xml @@ -50,6 +50,28 @@ ProxyPass "/ws2/" "ws://echo.websocket.org/" ProxyPass "/wss2/" "wss://echo.websocket.org/" +

Proxying both HTTP and websockets at the same time, with a specific set of URL's being +websocket-only, can be done by specifying the websockets +ProxyPass directive before the +HTTP directive:

+ +ProxyPassMatch ^/(myApp/ws)$ ws://example.com:9080/$1 +ProxyPass / http://example.com:9080/ + + +

Proxying both HTTP and websockets at the same time, where the websockets URL's are not +websocket-only or not known in advance can be done by using the +RewriteRule directive to +configure the websockets proxying:

+ +ProxyPass / http://example.com:9080/ +RewriteEngine on +RewriteCond %{HTTP:Upgrade} websocket [NC] +RewriteCond %{HTTP:Connection} upgrade [NC] +RewriteRule ^/?(.*) "ws://example.com:9080/$1" [P,L] + + +

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 -- 2.47.3