diff --git a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt index 5b1d0e2b..6b190af0 100644 --- a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt +++ b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt @@ -1 +1 @@ -663 +664 diff --git a/src/Backend/AutopilotMonitor.Functions/Middleware/AuthenticationMiddleware.cs b/src/Backend/AutopilotMonitor.Functions/Middleware/AuthenticationMiddleware.cs index 997c8b90..f09aba99 100644 --- a/src/Backend/AutopilotMonitor.Functions/Middleware/AuthenticationMiddleware.cs +++ b/src/Backend/AutopilotMonitor.Functions/Middleware/AuthenticationMiddleware.cs @@ -90,6 +90,13 @@ public class AuthenticationMiddleware : IFunctionsWorkerMiddleware return; } + // CORS preflight requests are handled by the Azure Functions host — let them through + if (string.Equals(httpContext.Request.Method, "OPTIONS", StringComparison.OrdinalIgnoreCase)) + { + await next(context); + return; + } + // Allow anonymous routes without JWT validation var requestPath = httpContext.Request.Path.Value ?? string.Empty; if (IsAnonymousRoute(requestPath))