Skip to main content

gglib_core/
cors.rs

1//! CORS configuration types.
2//!
3//! Provides [`CorsConfig`] to control which origins are allowed
4//! by the Axum web server's CORS middleware.
5
6/// CORS configuration for the web server.
7#[derive(Debug, Clone, Default, PartialEq, Eq)]
8pub enum CorsConfig {
9    /// Allow all origins (development mode).
10    AllowAll,
11    /// Allow specific origins (production mode).
12    AllowOrigins(Vec<String>),
13    /// Restrict to local-only access.
14    ///
15    /// Accepts `localhost`, `127.0.0.1`, `::1`, `tauri.localhost`,
16    /// and Tauri custom schemes (`tauri://localhost`, `asset://localhost`).
17    /// This is the default for both the web server and the proxy.
18    #[default]
19    LocalOnly,
20}