diff --git a/Program.cs b/Program.cs index 8852bce..0f5701c 100644 --- a/Program.cs +++ b/Program.cs @@ -231,6 +231,23 @@ app.Use(async (ctx, next) => }); // ---- Session middleware (must be before routing) ---- app.UseSession(); +app.Use(async (ctx, next) => +{ + var af = ctx.Request.Cookies[".Divers.Admin.AntiForgery"]; + app.Logger.LogInformation("AF cookie present={Present} len={Len} prefix={Prefix}", + af != null, + af?.Length ?? 0, + af == null ? "" : af.Substring(0, Math.Min(25, af.Length))); + + await next(); + + if (ctx.Response.Headers.TryGetValue("Set-Cookie", out var setCookies)) + { + foreach (var sc in setCookies) + if (sc.Contains(".Divers.Admin.AntiForgery", StringComparison.OrdinalIgnoreCase)) + app.Logger.LogInformation("SET-COOKIE AF: {SetCookie}", sc); + } +}); // ---- WebSockets endpoint ---- app.UseWebSockets(new WebSocketOptions { KeepAliveInterval = TimeSpan.FromSeconds(20) });