This commit is contained in:
2020-06-19 21:38:32 +00:00
parent a3c690c4b3
commit a6062f34db
2 changed files with 8 additions and 8 deletions

View File

@@ -344,7 +344,7 @@ namespace AyaNova
// {
// OnPrepareResponse = context =>
// {
// if (context.File.Name == "index.html")
// if (context.File.Name == "kindex.html")
// {
// context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
// context.Context.Response.Headers.Add("Expires", "-1");
@@ -584,8 +584,8 @@ namespace AyaNova
{
//to support html5 pushstate routing in spa
//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
await next();
if (!context.Response.HasStarted && context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
await next();
if (!context.Response.HasStarted && !context.Request.Path.Value.StartsWith("/api") && context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
{
context.Request.Path = "/index.html";
context.Response.StatusCode = 200;