From 6086ec276efb42713fac17674a6c0eb74ae667d0 Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Thu, 22 Aug 2024 10:20:13 +0200 Subject: [PATCH] Fixes #37761 - Allow rewrites needed for cockpit integration --- spec/classes/plugin/remote_execution_cockpit_spec.rb | 4 ++-- templates/cockpit-apache-ssl.conf.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/classes/plugin/remote_execution_cockpit_spec.rb b/spec/classes/plugin/remote_execution_cockpit_spec.rb index 4913e6d01..f5fc779d6 100644 --- a/spec/classes/plugin/remote_execution_cockpit_spec.rb +++ b/spec/classes/plugin/remote_execution_cockpit_spec.rb @@ -70,8 +70,8 @@ class {'foreman': is_expected.to contain_foreman__config__apache__fragment('cockpit') .without_content .with_ssl_content(%r{^$}) - .with_ssl_content(%r{^ RewriteRule /webcon/\(\.\*\) ws://127\.0\.0\.1:19090/webcon/\$1 \[P\]$}) - .with_ssl_content(%r{^ RewriteRule /webcon/\(\.\*\) http://127\.0\.0\.1:19090/webcon/\$1 \[P\]$}) + .with_ssl_content(%r{^ RewriteRule /webcon/\(\.\*\) ws://127\.0\.0\.1:19090/webcon/\$1 \[P,UnsafeAllow3F\]$}) + .with_ssl_content(%r{^ RewriteRule /webcon/\(\.\*\) http://127\.0\.0\.1:19090/webcon/\$1 \[P,UnsafeAllow3F\]$}) end end diff --git a/templates/cockpit-apache-ssl.conf.erb b/templates/cockpit-apache-ssl.conf.erb index 91fe9cadc..dcbc0497a 100644 --- a/templates/cockpit-apache-ssl.conf.erb +++ b/templates/cockpit-apache-ssl.conf.erb @@ -5,7 +5,7 @@ RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] - RewriteRule <%= @cockpit_path %>/(.*) ws://<%= @cockpit_host %>:<%= @cockpit_port %><%= @cockpit_path %>/$1 [P] + RewriteRule <%= @cockpit_path %>/(.*) ws://<%= @cockpit_host %>:<%= @cockpit_port %><%= @cockpit_path %>/$1 [P,UnsafeAllow3F] RewriteCond %{HTTP:Upgrade} !=websocket [NC] - RewriteRule <%= @cockpit_path %>/(.*) http://<%= @cockpit_host %>:<%= @cockpit_port %><%= @cockpit_path %>/$1 [P] + RewriteRule <%= @cockpit_path %>/(.*) http://<%= @cockpit_host %>:<%= @cockpit_port %><%= @cockpit_path %>/$1 [P,UnsafeAllow3F]