// // CORS.swift // Zyquo Router // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // // Permissive-by-default CORS so browser-based tooling can call the router // on localhost. Configurable origin in Settings (Phase 6). // import Foundation import NIOHTTP1 struct CORS { var allowedOrigin: String = "*" var headers: [(String, String)] { [ ("Access-Control-Allow-Origin", allowedOrigin), ("Access-Control-Allow-Methods", "GET, POST, OPTIONS"), ("Access-Control-Allow-Headers", "Authorization, Content-Type, OpenAI-Beta, X-Requested-With"), ("Access-Control-Max-Age", "600"), ] } /// Response to a preflight `OPTIONS` request. func preflightResponse() -> RouteResult { .complete(status: .noContent, headers: headers, body: Data()) } }