Support Socket.IO websocket proxying

tags/0.3.1_0.fc26_el6 0.3.1_0.fc26_el6
Daniel Berteaud 7 years ago
parent 7a5c42f80e
commit a72f708874
  1. 6
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule98ExtraMod
  2. 21
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/50Content

@ -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…
Cancel
Save