diff --git a/DeepDrftPublic/Controllers/TrackProxyController.cs b/DeepDrftPublic/Controllers/TrackProxyController.cs index 8056156..5d1af5a 100644 --- a/DeepDrftPublic/Controllers/TrackProxyController.cs +++ b/DeepDrftPublic/Controllers/TrackProxyController.cs @@ -10,13 +10,13 @@ namespace DeepDrftPublic.Controllers; /// named clients — no proxy hop needed on the server side. /// [ApiController] -[Route("api/[controller]")] -public class TrackController : ControllerBase +[Route("api/track")] +public class TrackProxyController : ControllerBase { private readonly HttpClient _upstream; - private readonly ILogger _logger; + private readonly ILogger _logger; - public TrackController(IHttpClientFactory httpClientFactory, ILogger logger) + public TrackProxyController(IHttpClientFactory httpClientFactory, ILogger logger) { _upstream = httpClientFactory.CreateClient("DeepDrft.API"); _logger = logger; @@ -103,6 +103,7 @@ public class TrackController : ControllerBase Response.ContentLength = contentLength.Value; var stream = await upstream.Content.ReadAsStreamAsync(ct); + HttpContext.Response.RegisterForDispose(upstream); return File(stream, contentType, enableRangeProcessing: false); } } diff --git a/DeepDrftPublic/Program.cs b/DeepDrftPublic/Program.cs index 69dc7f7..095140b 100644 --- a/DeepDrftPublic/Program.cs +++ b/DeepDrftPublic/Program.cs @@ -2,12 +2,16 @@ using DeepDrftPublic; using MudBlazor.Services; using DeepDrftPublic.Components; using Microsoft.AspNetCore.HttpOverrides; +using NetBlocks.Utilities.Environment; var builder = WebApplication.CreateBuilder(args); // Add MudBlazor services builder.Services.AddMudServices(); +var apiPath = CredentialTools.ResolvePathOrThrow("api", "environment/api.json"); +builder.Configuration.AddJsonFile(apiPath, optional: false, reloadOnChange: false); + var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"] ?? throw new Exception("Content API URL is not configured"); var sqlApiUrl = builder.Configuration["ApiUrls:SqlApi"] ?? throw new Exception("ApiUrls:SqlApi is not configured");