From 7278413e5d831c9d4e59251bd4240f197221e7a5 Mon Sep 17 00:00:00 2001 From: iliajie Date: Fri, 23 Dec 2022 18:05:22 +0200 Subject: [PATCH] Fix to remove `proxy_redirect`, as `proxy_pass` does it all This will also fixes modifying redirects for Nginx --- virtual_feature.pl | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/virtual_feature.pl b/virtual_feature.pl index f3a2d3f..c1de034 100644 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -1975,17 +1975,6 @@ sub feature_create_web_balancer my $p = $balancer->{'path'}; if ($p ne '/') { $p =~ s/\/$//; - push(@{$l->{'members'}}, - { 'name' => 'rewrite', - 'words' => [ '^'.$p.'$', $p.'/', 'redirect' ], - }, - { 'name' => 'rewrite', - 'words' => [ '^'.$p.'(/.*)', '$1', 'break' ], - }, - { 'name' => 'proxy_redirect', - 'words' => [ $url, $p ], - }, - ); } push(@{$l->{'members'}}, { 'name' => 'proxy_pass', @@ -2077,25 +2066,6 @@ sub feature_modify_web_balancer &save_directive($l, "proxy_pass", \@urls); $url = @urls ? $urls[0] : undef; } -if (@urls && $balancer->{'path'} ne '/') { - # Add rewrites for the path - my $p = $balancer->{'path'}; - $p =~ s/\/$//; - &save_directive($l, 'rewrite', - { 'name' => 'rewrite', - 'words' => [ '^'.$p.'$', $p.'/', 'redirect' ], - }, - { 'name' => 'rewrite', - 'words' => [ '^'.$p.'(/.*)', '$1', 'break' ], - }, - { 'name' => 'proxy_redirect', - 'words' => [ $url, $p ], - }, - ); - } -else { - &save_directive($l, 'rewrite', [ ]); - } &flush_config_file_lines(); &unlock_all_config_files(); &virtual_server::register_post_action(\&print_apply_nginx);