Support Socket.IO websocket proxying
This commit is contained in:
parent
7a5c42f80e
commit
a72f708874
|
@ -12,4 +12,10 @@ if ( -e '/usr/lib64/httpd/modules/mod_authnz_ldap.so' ||
|
|||
$OUT .= "LoadModule authnz_ldap_module modules/mod_authnz_ldap.so\n";
|
||||
}
|
||||
|
||||
# Load wstunnel if available
|
||||
if ( -e '/usr/lib64/httpd/modules/mod_proxy_wstunnel.so' ||
|
||||
-e '/usr/lib/httpd/modules/mod_proxy_wstunnel.so'){
|
||||
$OUT .= "LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ my $auth = $domain->prop('Authentication') || 'none';
|
|||
my @groups = split(/[;,]/, ($domain->prop('AllowGroups') || ''));
|
||||
my $ssl_port = $modSSL{'TCPPort'} || '443';
|
||||
my $proto = ($port eq $ssl_port ) ? 'https' : 'http';
|
||||
my $socketio = $domain->prop('ProxySocketIO') || 'disabled';
|
||||
|
||||
# ProxyPass ?
|
||||
if ($target =~ m|https?://[\d\w\.\-/]*|){
|
||||
|
@ -31,6 +32,26 @@ if ($target =~ m|https?://[\d\w\.\-/]*|){
|
|||
if ($proxy_acme eq 'disabled'){
|
||||
$OUT .= " ProxyPass /.well-known/acme-challenge/ !\n";
|
||||
}
|
||||
if ($socketio eq 'enabled'){
|
||||
# Try to handle Socket.IO
|
||||
my $wstarget = $target;
|
||||
$wstarget =~ s/^http:/ws:/;
|
||||
$wstarget =~ s/^https:/wss:/;
|
||||
$OUT .=<<"_EOF"
|
||||
|
||||
<IfModule mod_proxy_wstunnel.c>
|
||||
RewriteCond %{QUERY_STRING} transport=polling [NC]
|
||||
RewriteRule /socket.io/(.*) ${target}socket.io/\$1 [P,L]
|
||||
|
||||
ProxyPass /socket.io/socket.io.js ${target}socket.io/socket.io.js
|
||||
ProxyPassReverse /socket.io/socket.io.js ${target}socket.io/socket.io.js
|
||||
|
||||
ProxyPass /socket.io/ ${wstarget}socket.io/
|
||||
ProxyPassReverse /socket.io/ ${wstarget}socket.io/
|
||||
</IfModule>
|
||||
|
||||
_EOF
|
||||
}
|
||||
$OUT .= " ProxyPass / $target\n";
|
||||
$OUT .= " ProxyPassReverse / $target\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue