diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index 55d347db1..b797bfc97 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -18,6 +18,7 @@ using System.IO; using Microsoft.Extensions.DependencyInjection.Extensions; using BTCPayServer.Security; using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Net.Http.Headers; using System.Net; using BTCPayServer.PaymentRequest; using BTCPayServer.Services.Apps; @@ -189,7 +190,17 @@ namespace BTCPayServer.Hosting app.UseRouting(); app.UseCors(); - app.UseStaticFiles(); + app.UseStaticFiles(new StaticFileOptions + { + OnPrepareResponse = ctx => + { + // Cache static assets for one year, set asp-append-version="true" on references to update on change. + // https://andrewlock.net/adding-cache-control-headers-to-static-files-in-asp-net-core/ + const int durationInSeconds = 60 * 60 * 24 * 365; + ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=" + durationInSeconds; + } + }); + app.UseProviderStorage(options); app.UseAuthentication(); app.UseAuthorization(); diff --git a/BTCPayServer/Views/Account/LoginWithU2F.cshtml b/BTCPayServer/Views/Account/LoginWithU2F.cshtml index 97949f43d..682854b98 100644 --- a/BTCPayServer/Views/Account/LoginWithU2F.cshtml +++ b/BTCPayServer/Views/Account/LoginWithU2F.cshtml @@ -29,7 +29,7 @@ - + - - + + + + + - - + + } diff --git a/BTCPayServer/Views/AppsPublic/Crowdfund/ContributeForm.cshtml b/BTCPayServer/Views/AppsPublic/Crowdfund/ContributeForm.cshtml index 74f45b18a..efc6329b5 100644 --- a/BTCPayServer/Views/AppsPublic/Crowdfund/ContributeForm.cshtml +++ b/BTCPayServer/Views/AppsPublic/Crowdfund/ContributeForm.cshtml @@ -10,7 +10,7 @@ } @if (!string.IsNullOrEmpty(item.Image)) { - + }
diff --git a/BTCPayServer/Views/AppsPublic/Crowdfund/MinimalCrowdfund.cshtml b/BTCPayServer/Views/AppsPublic/Crowdfund/MinimalCrowdfund.cshtml index 1ccfa9d83..c1731b2d7 100644 --- a/BTCPayServer/Views/AppsPublic/Crowdfund/MinimalCrowdfund.cshtml +++ b/BTCPayServer/Views/AppsPublic/Crowdfund/MinimalCrowdfund.cshtml @@ -8,7 +8,7 @@
@if (!string.IsNullOrEmpty(Model.MainImageUrl)) { - + }

diff --git a/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml b/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml index 9ab010371..44ebe3a40 100644 --- a/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml +++ b/BTCPayServer/Views/AppsPublic/ViewCrowdfund.cshtml @@ -24,13 +24,13 @@ - - + + @*We need to make sure btcpay.js is not bundled, else it will not work if there is a RootPath*@ - + } - + @if (!string.IsNullOrEmpty(Model.EmbeddedCSS)) { @Safe.Raw($""); diff --git a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml index 3a5446b2c..5e424f936 100644 --- a/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml +++ b/BTCPayServer/Views/AppsPublic/ViewPointOfSale.cshtml @@ -21,21 +21,21 @@ - - + + @if (Model.CustomCSSLink != null) { } - + @if (Model.EnableShoppingCart) { - + - + }