diff --git a/src/ServiceControl.Audit/Infrastructure/WebApi/RootController.cs b/src/ServiceControl.Audit/Infrastructure/WebApi/RootController.cs index 159e8c6d49..064122234d 100644 --- a/src/ServiceControl.Audit/Infrastructure/WebApi/RootController.cs +++ b/src/ServiceControl.Audit/Infrastructure/WebApi/RootController.cs @@ -18,17 +18,19 @@ public RootController(Settings settings) [HttpGet] public OkObjectResult Urls() { - var baseUrl = Request.GetDisplayUrl() + "/"; + var baseUrl = Request.GetDisplayUrl(); + + if (!baseUrl.EndsWith('/')) + { + baseUrl += "/"; + } + var model = new RootUrls { KnownEndpointsUrl = "/endpoints/known", // relative URI to allow proxying - MessageSearchUrl = - baseUrl + "messages/search/{keyword}/{?page,per_page,direction,sort}", - EndpointsMessageSearchUrl = - baseUrl + - "endpoints/{name}/messages/search/{keyword}/{?page,per_page,direction,sort}", - EndpointsMessagesUrl = - baseUrl + "endpoints/{name}/messages/{?page,per_page,direction,sort}", + MessageSearchUrl = baseUrl + "messages/search/{keyword}/{?page,per_page,direction,sort}", + EndpointsMessageSearchUrl = baseUrl + "endpoints/{name}/messages/search/{keyword}/{?page,per_page,direction,sort}", + EndpointsMessagesUrl = baseUrl + "endpoints/{name}/messages/{?page,per_page,direction,sort}", AuditCountUrl = baseUrl + "endpoints/{name}/audit-count", Name = SettingsReader.Read(Settings.SettingsRootNamespace, "Name", "ServiceControl.Audit"), Description = SettingsReader.Read(Settings.SettingsRootNamespace, "Description", "The audit backend for the Particular Service Platform"), diff --git a/src/ServiceControl/Infrastructure/Api/ConfigurationApi.cs b/src/ServiceControl/Infrastructure/Api/ConfigurationApi.cs index f8af272eb4..607013d677 100644 --- a/src/ServiceControl/Infrastructure/Api/ConfigurationApi.cs +++ b/src/ServiceControl/Infrastructure/Api/ConfigurationApi.cs @@ -14,12 +14,15 @@ using ServiceControl.Api; using ServiceControl.Api.Contracts; -class ConfigurationApi(ActiveLicense license, - Settings settings, - IHttpClientFactory httpClientFactory, MassTransitConnectorHeartbeatStatus connectorHeartbeatStatus) : IConfigurationApi +class ConfigurationApi(ActiveLicense license, Settings settings, IHttpClientFactory httpClientFactory, MassTransitConnectorHeartbeatStatus connectorHeartbeatStatus) : IConfigurationApi { public Task GetUrls(string baseUrl, CancellationToken cancellationToken) { + if (!baseUrl.EndsWith('/')) + { + baseUrl += "/"; + } + var model = new RootUrls { EndpointsUrl = baseUrl + "endpoints", @@ -27,13 +30,9 @@ public Task GetUrls(string baseUrl, CancellationToken cancellationToke SagasUrl = baseUrl + "sagas", ErrorsUrl = baseUrl + "errors/{?page,per_page,direction,sort}", EndpointsErrorUrl = baseUrl + "endpoints/{name}/errors/{?page,per_page,direction,sort}", - MessageSearchUrl = - baseUrl + "messages/search/{keyword}/{?page,per_page,direction,sort}", - EndpointsMessageSearchUrl = - baseUrl + - "endpoints/{name}/messages/search/{keyword}/{?page,per_page,direction,sort}", - EndpointsMessagesUrl = - baseUrl + "endpoints/{name}/messages/{?page,per_page,direction,sort}", + MessageSearchUrl = baseUrl + "messages/search/{keyword}/{?page,per_page,direction,sort}", + EndpointsMessageSearchUrl = baseUrl + "endpoints/{name}/messages/search/{keyword}/{?page,per_page,direction,sort}", + EndpointsMessagesUrl = baseUrl + "endpoints/{name}/messages/{?page,per_page,direction,sort}", AuditCountUrl = baseUrl + "endpoints/{name}/audit-count", Name = SettingsReader.Read(Settings.SettingsRootNamespace, "Name", "ServiceControl"), Description = SettingsReader.Read(Settings.SettingsRootNamespace, "Description", "The management backend for the Particular Service Platform"), diff --git a/src/ServiceControl/Infrastructure/WebApi/RootController.cs b/src/ServiceControl/Infrastructure/WebApi/RootController.cs index 707638a183..f86b400be1 100644 --- a/src/ServiceControl/Infrastructure/WebApi/RootController.cs +++ b/src/ServiceControl/Infrastructure/WebApi/RootController.cs @@ -13,7 +13,7 @@ public class RootController(IConfigurationApi configurationApi) : ControllerBase { [Route("")] [HttpGet] - public Task Urls() => configurationApi.GetUrls(Request.GetDisplayUrl() + "/", default); + public Task Urls() => configurationApi.GetUrls(Request.GetDisplayUrl(), default); [Route("instance-info")] [Route("configuration")]