[pve-devel] [PATCH pve-http-server] remove trailing slash from URL path

Dietmar Maurer dietmar at proxmox.com
Thu Oct 5 14:43:54 CEST 2017


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/APIServer/AnyEvent.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm
index 703d25c..0eb574d 100755
--- a/PVE/APIServer/AnyEvent.pm
+++ b/PVE/APIServer/AnyEvent.pm
@@ -1131,6 +1131,9 @@ sub unshift_read_header {
 	    if ($line eq '') {
 
 		my $path = uri_unescape($r->uri->path());
+		$path =~ s|\/+$||; # remove trailing slash
+		$path = '/' if $path eq '';
+
 		my $method = $r->method();
 
 		$r->push_header($state->{key}, $state->{val})
-- 
2.11.0





More information about the pve-devel mailing list