I was hitting an issue where there were multiple reverseproxy instances configured for a single host and some of the rewrite rules were changing the request when they shouldn't be.
This patch adds a rewritecond to the websocket rewrite rule to make sure that the REQUEST_URI starts with $remotepath before it's rewritten. --- roles/httpd/reverseproxy/templates/reversepassproxy.conf | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/roles/httpd/reverseproxy/templates/reversepassproxy.conf b/roles/httpd/reverseproxy/templates/reversepassproxy.conf index 38950e4..1e4afe0 100644 --- a/roles/httpd/reverseproxy/templates/reversepassproxy.conf +++ b/roles/httpd/reverseproxy/templates/reversepassproxy.conf @@ -47,6 +47,9 @@ SSLProxyEngine On RewriteEngine on RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC] RewriteCond %{HTTP:Connection} Upgrade [NC] +{% if remotepath is defined %} +RewriteCond %{REQUEST_URI} ^{{ remotepath }}/(.)* +{% endif %} RewriteRule .* "balancer://{{ balancer_name }}-websocket%{REQUEST_URI}" [P] <Proxy "balancer://{{balancer_name}}">
Reviewed. +1
On Fri, 22 Mar 2019 at 16:04, Tim Flink tflink@redhat.com wrote:
I was hitting an issue where there were multiple reverseproxy instances configured for a single host and some of the rewrite rules were changing the request when they shouldn't be.
This patch adds a rewritecond to the websocket rewrite rule to make sure that the REQUEST_URI starts with $remotepath before it's rewritten.
roles/httpd/reverseproxy/templates/reversepassproxy.conf | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/roles/httpd/reverseproxy/templates/reversepassproxy.conf b/roles/httpd/reverseproxy/templates/reversepassproxy.conf index 38950e4..1e4afe0 100644 --- a/roles/httpd/reverseproxy/templates/reversepassproxy.conf +++ b/roles/httpd/reverseproxy/templates/reversepassproxy.conf @@ -47,6 +47,9 @@ SSLProxyEngine On RewriteEngine on RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC] RewriteCond %{HTTP:Connection} Upgrade [NC] +{% if remotepath is defined %} +RewriteCond %{REQUEST_URI} ^{{ remotepath }}/(.)* +{% endif %} RewriteRule .* "balancer://{{ balancer_name }}-websocket%{REQUEST_URI}" [P]
<Proxy "balancer://{{balancer_name}}">
1.8.3.1 _______________________________________________ infrastructure mailing list -- infrastructure@lists.fedoraproject.org To unsubscribe send an email to infrastructure-leave@lists.fedoraproject.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@lists.fedorapro...
On 3/22/19 1:04 PM, Tim Flink wrote:
I was hitting an issue where there were multiple reverseproxy instances configured for a single host and some of the rewrite rules were changing the request when they shouldn't be.
This patch adds a rewritecond to the websocket rewrite rule to make sure that the REQUEST_URI starts with $remotepath before it's rewritten.
roles/httpd/reverseproxy/templates/reversepassproxy.conf | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/roles/httpd/reverseproxy/templates/reversepassproxy.conf b/roles/httpd/reverseproxy/templates/reversepassproxy.conf index 38950e4..1e4afe0 100644 --- a/roles/httpd/reverseproxy/templates/reversepassproxy.conf +++ b/roles/httpd/reverseproxy/templates/reversepassproxy.conf @@ -47,6 +47,9 @@ SSLProxyEngine On RewriteEngine on RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC] RewriteCond %{HTTP:Connection} Upgrade [NC] +{% if remotepath is defined %} +RewriteCond %{REQUEST_URI} ^{{ remotepath }}/(.)* +{% endif %} RewriteRule .* "balancer://{{ balancer_name }}-websocket%{REQUEST_URI}" [P] <Proxy "balancer://{{balancer_name}}">
+1
kevin
Thanks for the +1s. Pushed to ansible repo and has been run on proxies-stg.
Tim
On Fri, 22 Mar 2019 14:04:37 -0600 Tim Flink tflink@redhat.com wrote:
I was hitting an issue where there were multiple reverseproxy instances configured for a single host and some of the rewrite rules were changing the request when they shouldn't be.
This patch adds a rewritecond to the websocket rewrite rule to make sure that the REQUEST_URI starts with $remotepath before it's rewritten. --- roles/httpd/reverseproxy/templates/reversepassproxy.conf | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/roles/httpd/reverseproxy/templates/reversepassproxy.conf b/roles/httpd/reverseproxy/templates/reversepassproxy.conf index 38950e4..1e4afe0 100644 --- a/roles/httpd/reverseproxy/templates/reversepassproxy.conf +++ b/roles/httpd/reverseproxy/templates/reversepassproxy.conf @@ -47,6 +47,9 @@ SSLProxyEngine On RewriteEngine on RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC] RewriteCond %{HTTP:Connection} Upgrade [NC] +{% if remotepath is defined %} +RewriteCond %{REQUEST_URI} ^{{ remotepath }}/(.)* +{% endif %} RewriteRule .* "balancer://{{ balancer_name }}-websocket%{REQUEST_URI}" [P] <Proxy "balancer://{{balancer_name}}">
infrastructure@lists.fedoraproject.org