sub prepare_path { my $c = shift; $c->maybe::next::method( @_ ) ; my $base_uri_prefix = $c->config->{base_uri_prefix} ; my @path_chunks = split m[/], $c->request->path, -1; if (@path_chunks && $path_chunks[0] eq $base_uri_prefix ) { shift @path_chunks ; my $path = join( '/' , @path_chunks ) || '/' ; $c->request->path( $path ) ; } else { $c->request->uri->path( "$base_uri_prefix/" . $c->request->path ) ; } my $base = $c->request->base; my $tbp = $base->path ; $tbp =~ s/hosta:porta/hostb/ ; $base->path( $tbp . "$base_uri_prefix/" ) ; $base->host( 'hostb' ) ; $base->port( undef ) ; $base->scheme( 'https' ) ; $c->request->base( $base ) ; return ; }