Skip to content

Commit

Permalink
Set no-cache on index.html fallback (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeaugrand authored Nov 28, 2021
1 parent 800ad82 commit 4f625a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/AzureIoTHub.Portal/Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace AzureIoTHub.Portal.Server
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Primitives;
using Microsoft.Graph;
using Microsoft.Identity.Client;
using Microsoft.Identity.Web;
Expand Down Expand Up @@ -176,7 +177,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
endpoints.Map("api/{**slug}", this.HandleApiFallback);
// If this is a request for a web page, just do the normal out-of-the-box behaviour.
endpoints.MapFallbackToFile("{**slug}", "index.html");
endpoints.MapFallbackToFile("{**slug}", "index.html", new StaticFileOptions
{
OnPrepareResponse = ctx => ctx.Context.Response.Headers.Add("Cache-Control", new StringValues("no-cache"))
});
});
}

Expand Down

0 comments on commit 4f625a2

Please sign in to comment.