-
{AyaNovaVersion.FullNameAndVersion}
+
{AyaNovaVersion.FullNameAndVersion}
+
AyaNova Client
AyaNova manual
API explorer
Email AyaNova support
diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs
index 82fba171..5cf17dbf 100644
--- a/server/AyaNova/Startup.cs
+++ b/server/AyaNova/Startup.cs
@@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Extensions.Hosting;
+using Microsoft.AspNetCore.Http;
using AyaNova.Models;
using AyaNova.Util;
@@ -304,17 +305,20 @@ namespace AyaNova
#region STATIC FILES
_log.LogDebug("BOOT: pipeline - static files");
app.UseDefaultFiles();
- app.UseStaticFiles(new StaticFileOptions
- {
- OnPrepareResponse = context =>
- {
- if (context.File.Name == "default.htm")
- {
- context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
- context.Context.Response.Headers.Add("Expires", "-1");
- }
- }
- });
+ app.UseStaticFiles();
+ //Might need the following if the page doesn't update in the client properly
+ //however the vue build process will automatically uniquify each build file names so maybe not required
+ // app.UseStaticFiles(new StaticFileOptions
+ // {
+ // OnPrepareResponse = context =>
+ // {
+ // if (context.File.Name == "index.html")
+ // {
+ // context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
+ // context.Context.Response.Headers.Add("Expires", "-1");
+ // }
+ // }
+ // });
#endregion
#region AUTH / ROLES
@@ -358,9 +362,6 @@ namespace AyaNova
_log.LogDebug("BOOT: pipeline - MVC");
app.UseMvc();
-
-
-
// ******************************************************************
// ******************** TESTING WIPE DB *****************************
//
@@ -410,9 +411,25 @@ namespace AyaNova
#endif
- //Set autoId values
+ //AUTOID VALUES INITIALIZATION
ServerBootConfig.SetMostRecentAutoIdValuesFromDatabase(dbContext);
+ //SPA FALLBACK ROUTE
+ //this ensures that a refresh at the client will not 404 but rather force back to the index.html app page and then handled internally
+ //by the client
+ app.Use(async (context, next) =>
+ {
+ await next();
+ if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
+ {
+ context.Request.Path = "/index.html";
+ context.Response.StatusCode = 200;
+ context.Response.ContentType = "text/html";
+ await context.Response.SendFileAsync(Path.Combine(env.WebRootPath, "index.html"));
+ }
+ });
+
+
//Open up the server for visitors
apiServerState.SetOpen();
diff --git a/server/AyaNova/wwwroot/index.htm b/server/AyaNova/wwwroot/index.htm
deleted file mode 100644
index 35cef4c7..00000000
--- a/server/AyaNova/wwwroot/index.htm
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file