diff --git a/src/Microsoft.Health.Fhir.Api/Features/Routing/UrlResolver.cs b/src/Microsoft.Health.Fhir.Api/Features/Routing/UrlResolver.cs index 16db79841..3488780a5 100644 --- a/src/Microsoft.Health.Fhir.Api/Features/Routing/UrlResolver.cs +++ b/src/Microsoft.Health.Fhir.Api/Features/Routing/UrlResolver.cs @@ -346,7 +346,7 @@ namespace Microsoft.Health.Fhir.Api.Features.Routing // NOTE: Append "/" to the end of the path base to workaround a known bug in UrlHelper.RouteUrl for endpoint routing. // Remove the workaround when we pick up the fix. (https://github.com/dotnet/aspnetcore/issues/53177) var pathBase = httpContext.Request?.PathBase.ToString(); - if (!string.IsNullOrEmpty(pathBase) && (string.IsNullOrEmpty(httpContext.Request?.Path) || string.Equals(httpContext.Request?.Path, "/", StringComparison.Ordinal))) + if (!string.IsNullOrEmpty(pathBase) && !pathBase.EndsWith('/') && (string.IsNullOrEmpty(httpContext.Request?.Path) || string.Equals(httpContext.Request?.Path, "/", StringComparison.Ordinal))) { pathBase += "/"; }