Skip to main content

Posts

Showing posts with the label YARP

Sharing Auth Cookies Between Legacy ASP.NET WebForms and Next.js Using YARP

  The "Strangler Fig" pattern is the de facto standard for modernizing monoliths, but it introduces a distinct architectural fracture: identity. When you place a Next.js micro-frontend alongside a legacy ASP.NET 4.x application, they live in different runtimes. A browser cookie issued by ASP.NET WebForms (encrypted with MachineKey) is an opaque, undecipherable blob to a Node.js server. Consequently, users navigating from  /legacy/dashboard  to  /next/profile  effectively "log out" because the Next.js server cannot validate the session credentials. This post details how to bridge that gap using  YARP (Yet Another Reverse Proxy)  as an authentication gateway, ensuring seamless session propagation without rewriting your legacy authentication logic immediately. The Root Cause: Incompatible Encryption The failure isn't in the transport; the browser successfully sends the cookie to both paths (assuming correct domain scope). The failure is in  decryptio...