From 5819ab2012867265e3ce49d0dcf4196a8c475dea Mon Sep 17 00:00:00 2001 From: Emil Einarsson Date: Wed, 9 Oct 2024 20:57:13 +0200 Subject: [PATCH] reset routing path when siterouting and no route is found --- core/Piranha.AspNetCore/Http/RoutingMiddleware.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/Piranha.AspNetCore/Http/RoutingMiddleware.cs b/core/Piranha.AspNetCore/Http/RoutingMiddleware.cs index ce0d6b78f..df4c50757 100644 --- a/core/Piranha.AspNetCore/Http/RoutingMiddleware.cs +++ b/core/Piranha.AspNetCore/Http/RoutingMiddleware.cs @@ -469,6 +469,11 @@ public override async Task Invoke(HttpContext context, IApi api, IApplicationSer new QueryString("?" + strQuery); } } + else { + _logger?.LogDebug("No route found"); + // No route found. Reset the path to raw path because site routing might have changed it. + context.Request.Path = new PathString(service.Request.Url); + } } await _next.Invoke(context); }