Skip to content

Commit b4dde0f

Browse files
committed
add cache-control header to prevent checkout pages from being cached.
1 parent 04b888d commit b4dde0f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.AspNetCore.Mvc.Filters;
2+
3+
namespace Umbraco.Commerce.Checkout.Web.Controllers.Filters
4+
{
5+
/// <summary>
6+
/// Add "cache-control: no-store" header to the response.
7+
/// </summary>
8+
internal sealed class NoStoreCacheControlAttribute : ActionFilterAttribute
9+
{
10+
public override void OnActionExecuted(ActionExecutedContext context)
11+
{
12+
context.HttpContext.Response.Headers.CacheControl = "no-store";
13+
}
14+
}
15+
}

src/Umbraco.Commerce.Checkout/Web/Controllers/UmbracoCommerceCheckoutBaseController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
using Umbraco.Commerce.Core.Api;
99
using Umbraco.Commerce.Core.Models;
1010
using Umbraco.Extensions;
11+
using Umbraco.Commerce.Checkout.Web.Controllers.Filters;
1112

1213
namespace Umbraco.Commerce.Checkout.Web.Controllers
1314
{
15+
[NoStoreCacheControl]
1416
public abstract class UmbracoCommerceCheckoutBaseController : RenderController
1517
{
1618
protected UmbracoCommerceCheckoutBaseController(

0 commit comments

Comments
 (0)