Blazor Server Authentication Loop (Cookie issue) behind FortiWeb (SSL Offloading)
Hi everyone,
I'm facing a persistent login loop with a Blazor Server (.NET Core) application hosted on IIS 10, sitting behind a FortiWeb appliance.
The setup:
External Traffic: HTTPS (SSL handled by FortiWeb).
Internal Traffic: HTTP (between FortiWeb and IIS).
Server Side: I have configured IIS URL Rewrite to force HTTPS=on server variable and enabled X-Forwarded-Proto support.
The Problem:
When users try to log in, the authentication cookie (.AspNetCore.Cookies or .AspNetCore.Identity.Application) is never stored in the browser, although other cookies like .AspNetCore.Session and FortiWeb's persistence cookies are present. This causes an infinite redirect loop back to the login page.
Locally (bypassing FortiWeb), the application works perfectly and the authentication cookie is generated correctly.
What I've tried so far:
Enabled "Add X-Forwarded-Proto" and "Add X-Forwarded-For" in the FortiWeb X-Forwarded-For Rule.
Verified that "Cookie Security" is disabled in the Web Protection Profile to avoid interference.
Configured IIS to treat the connection as secure via URL Rewrite rules.
Checked that WebSockets (required for Blazor) are supposedly passing through, but the session never establishes because the Auth Cookie is missing.
Questions:
Is there a specific setting in the Web Protection Profile that might be stripping .AspNetCore.* cookies even if Cookie Security is off?
Does FortiWeb require specific Rewriting Rules to handle the SameSite=Lax or Secure attributes that .NET Core Identity adds to cookies when it thinks it's on HTTPS?
Are there any known issues with SignalR/WebSockets persistence that could be causing the server to drop the authentication challenge?
Any guidance on the FortiWeb configuration (Server Policy or Protection Profile) would be greatly appreciated.
