From b7d040d33db9d5bd0b6cd7a83d65f14d3e19fb62 Mon Sep 17 00:00:00 2001 From: Oliver Kieselbach Date: Sat, 28 Mar 2026 08:54:39 +0100 Subject: [PATCH] CORS fix --- .mcp.json | 2 +- src/Agent/AutopilotMonitor.Agent/buildcounter.txt | 2 +- .../Middleware/PolicyEnforcementMiddleware.cs | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.mcp.json b/.mcp.json index 17fb55b9..1633f6ee 100644 --- a/.mcp.json +++ b/.mcp.json @@ -2,7 +2,7 @@ "mcpServers": { "autopilot-monitor": { "type": "streamable-http", - "url": "https://autopilotmonitor-mcp.azurecontainerapps.io/mcp" + "url": "https://autopilotmonitor-mcp.kindwave-58b4b547.westeurope.azurecontainerapps.io/mcp" } } } diff --git a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt index b4d5aee0..5b1d0e2b 100644 --- a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt +++ b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt @@ -1 +1 @@ -662 +663 diff --git a/src/Backend/AutopilotMonitor.Functions/Middleware/PolicyEnforcementMiddleware.cs b/src/Backend/AutopilotMonitor.Functions/Middleware/PolicyEnforcementMiddleware.cs index 50435146..35fd8575 100644 --- a/src/Backend/AutopilotMonitor.Functions/Middleware/PolicyEnforcementMiddleware.cs +++ b/src/Backend/AutopilotMonitor.Functions/Middleware/PolicyEnforcementMiddleware.cs @@ -50,6 +50,13 @@ public class PolicyEnforcementMiddleware : IFunctionsWorkerMiddleware var requestPath = httpContext.Request.Path.Value ?? string.Empty; var httpMethod = httpContext.Request.Method; + // CORS preflight requests are handled by the Azure Functions host — let them through + if (string.Equals(httpMethod, "OPTIONS", StringComparison.OrdinalIgnoreCase)) + { + await next(context); + return; + } + // Look up the catalog policy for this route var catalogEntry = EndpointAccessPolicyCatalog.FindPolicy(httpMethod, requestPath);