diff --git a/Program.cs b/Program.cs index 0cac04b..7a14e90 100644 --- a/Program.cs +++ b/Program.cs @@ -49,6 +49,8 @@ builder.Services.AddSession(options => options.Cookie.Path = "/admin"; options.Cookie.SecurePolicy = CookieSecurePolicy.Always; options.Cookie.SameSite = SameSiteMode.Lax; + // Avoid double-encoding/chunking issues that can break DP unprotect. + options.CookieManager = new ChunkingCookieManager { ChunkSize = null }; }); builder.Services.AddAntiforgery(o => { @@ -150,6 +152,16 @@ fwdOpts.KnownProxies.Clear(); app.UseForwardedHeaders(fwdOpts); app.UseRouting(); +app.Use(async (ctx, next) => +{ + var raw = ctx.Request.Headers.Cookie.ToString(); + var session = ctx.Request.Cookies[".Divers.Admin.Session"]; + if (!string.IsNullOrEmpty(raw)) + app.Logger.LogInformation("RAW Cookie Header: {Raw}", raw); + app.Logger.LogInformation("Decoded Session Cookie: {Session}", session ?? ""); + + await next(); +}); // ---- Session middleware (must be before routing) ---- app.UseSession();