Skip to content

Commit

Permalink
Fix to remove proxy_redirect, as proxy_pass does it all
Browse files Browse the repository at this point in the history
This will also fixes modifying redirects for Nginx
  • Loading branch information
iliajie committed Dec 23, 2022
1 parent 08672d3 commit 7278413
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7278413

Please sign in to comment.