From 2e371b2db95771f9a56f3e679ce8b094a9786fab Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Tue, 12 May 2026 16:10:17 -0500 Subject: [PATCH] Attempt to support WebSocket redirects Signed-off-by: Jason Rothstein --- .../templates/Fedora/42/etc/httpd/conf.d/vhost.conf | 6 ++++++ .../templates/Fedora/43/etc/httpd/conf.d/vhost.conf | 6 ++++++ .../templates/Fedora/44/etc/httpd/conf.d/vhost.conf | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/roles/ensure_apache/templates/Fedora/42/etc/httpd/conf.d/vhost.conf b/roles/ensure_apache/templates/Fedora/42/etc/httpd/conf.d/vhost.conf index b3d60e1..9197383 100644 --- a/roles/ensure_apache/templates/Fedora/42/etc/httpd/conf.d/vhost.conf +++ b/roles/ensure_apache/templates/Fedora/42/etc/httpd/conf.d/vhost.conf @@ -58,6 +58,12 @@ MDomain {{ item.fqdn }} ProxyPassReverse "/" "{{ item.proxy }}" ProxyTimeout 300 {% endif %} +{% if item.rewrite is defined %} + RewriteEngine On + RewriteCond %{HTTP:Upgrade} websocket [NC] + RewriteCond %{HTTP:Connection} upgrade [NC] + RewriteRule ^/?(.*) ws://{{ item.proxy }}/$1 [P,L] +{% endif %} {% if item.redirect is defined %} RedirectMatch "^(?!/\.well-known/).*" {{ item.redirect }} {% endif %} diff --git a/roles/ensure_apache/templates/Fedora/43/etc/httpd/conf.d/vhost.conf b/roles/ensure_apache/templates/Fedora/43/etc/httpd/conf.d/vhost.conf index b3d60e1..9197383 100644 --- a/roles/ensure_apache/templates/Fedora/43/etc/httpd/conf.d/vhost.conf +++ b/roles/ensure_apache/templates/Fedora/43/etc/httpd/conf.d/vhost.conf @@ -58,6 +58,12 @@ MDomain {{ item.fqdn }} ProxyPassReverse "/" "{{ item.proxy }}" ProxyTimeout 300 {% endif %} +{% if item.rewrite is defined %} + RewriteEngine On + RewriteCond %{HTTP:Upgrade} websocket [NC] + RewriteCond %{HTTP:Connection} upgrade [NC] + RewriteRule ^/?(.*) ws://{{ item.proxy }}/$1 [P,L] +{% endif %} {% if item.redirect is defined %} RedirectMatch "^(?!/\.well-known/).*" {{ item.redirect }} {% endif %} diff --git a/roles/ensure_apache/templates/Fedora/44/etc/httpd/conf.d/vhost.conf b/roles/ensure_apache/templates/Fedora/44/etc/httpd/conf.d/vhost.conf index b3d60e1..9197383 100644 --- a/roles/ensure_apache/templates/Fedora/44/etc/httpd/conf.d/vhost.conf +++ b/roles/ensure_apache/templates/Fedora/44/etc/httpd/conf.d/vhost.conf @@ -58,6 +58,12 @@ MDomain {{ item.fqdn }} ProxyPassReverse "/" "{{ item.proxy }}" ProxyTimeout 300 {% endif %} +{% if item.rewrite is defined %} + RewriteEngine On + RewriteCond %{HTTP:Upgrade} websocket [NC] + RewriteCond %{HTTP:Connection} upgrade [NC] + RewriteRule ^/?(.*) ws://{{ item.proxy }}/$1 [P,L] +{% endif %} {% if item.redirect is defined %} RedirectMatch "^(?!/\.well-known/).*" {{ item.redirect }} {% endif %}