aboutsummaryrefslogtreecommitdiff
path: root/lib/Plugins.Essentials/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Plugins.Essentials/src')
-rw-r--r--lib/Plugins.Essentials/src/Extensions/SingleCookieController.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Plugins.Essentials/src/Extensions/SingleCookieController.cs b/lib/Plugins.Essentials/src/Extensions/SingleCookieController.cs
index c4b7619..ef86934 100644
--- a/lib/Plugins.Essentials/src/Extensions/SingleCookieController.cs
+++ b/lib/Plugins.Essentials/src/Extensions/SingleCookieController.cs
@@ -99,10 +99,13 @@ namespace VNLib.Plugins.Essentials.Extensions
Value = value,
Domain = Domain,
Path = Path,
- MaxAge = ValidFor,
+ //Only set max-age if cookie has a value, otherwise set to zero to expire
+ MaxAge = string.IsNullOrWhiteSpace(value) ? TimeSpan.Zero : ValidFor,
IsSession = ValidFor == TimeSpan.MaxValue,
SameSite = SameSite,
HttpOnly = HttpOnly,
+
+ //Secure is required on cross origin requests
Secure = Secure | entity.Server.CrossOrigin,
};