pub struct CorsConfig {
pub allowed_origins: Vec<String>,
}Expand description
Cross-origin policy snapshot loaded from the process environment.
allowed_origins is the explicit allowlist of cross-origin browser
callers that may reach the API. The default is empty — i.e.
cross-origin requests are rejected until the operator widens the
allowlist. This matches the gateway’s other security defaults
(TENSOR_WASM_API_TOKENS dev mode is the only opt-out).
To widen, list one origin per entry exactly as the browser sends the
Origin header (scheme + host + optional port), comma-separated:
TENSOR_WASM_API_CORS_ALLOWED_ORIGINS=https://app.example.com,https://admin.example.comFields§
§allowed_origins: Vec<String>Origins permitted for cross-origin requests. Empty = reject all.
Implementations§
Source§impl CorsConfig
impl CorsConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Load the allowlist from $TENSOR_WASM_API_CORS_ALLOWED_ORIGINS.
Unset or empty = reject all cross-origin requests.
Sourcepub fn from_origins<I, S>(iter: I) -> Self
pub fn from_origins<I, S>(iter: I) -> Self
Construct directly from an explicit list of origins. The empty list yields the safe default (no cross-origin requests admitted).
Trait Implementations§
Source§impl Clone for CorsConfig
impl Clone for CorsConfig
Source§fn clone(&self) -> CorsConfig
fn clone(&self) -> CorsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CorsConfig
impl Debug for CorsConfig
Source§impl Default for CorsConfig
impl Default for CorsConfig
Source§fn default() -> CorsConfig
fn default() -> CorsConfig
Auto Trait Implementations§
impl Freeze for CorsConfig
impl RefUnwindSafe for CorsConfig
impl Send for CorsConfig
impl Sync for CorsConfig
impl Unpin for CorsConfig
impl UnsafeUnpin for CorsConfig
impl UnwindSafe for CorsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more