diff --git a/API/Controllers/FallbackController.cs b/API/Controllers/FallbackController.cs index 2f5d7fce..faaf128a 100644 --- a/API/Controllers/FallbackController.cs +++ b/API/Controllers/FallbackController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using API.Services; using Microsoft.AspNetCore.Authorization; @@ -22,7 +22,7 @@ public class FallbackController : Controller public ActionResult Index() { - return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html"), "text/HTML"); + return PhysicalFile(Path.Combine("@web_root@", "index.html"), "text/HTML"); } } diff --git a/API/Startup.cs b/API/Startup.cs index f84ef638..7eaeb05e 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -33,6 +33,7 @@ using Microsoft.AspNetCore.ResponseCompression; using Microsoft.AspNetCore.StaticFiles; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; @@ -298,6 +299,7 @@ public class Startup app.UseStaticFiles(new StaticFileOptions { + FileProvider = new PhysicalFileProvider("@web_root@"), ContentTypeProvider = new FileExtensionContentTypeProvider(), HttpsCompression = HttpsCompressionMode.Compress, OnPrepareResponse = ctx =>