Class RouteCorsOptions

Namespace: redb.Route.Http
Assembly: redb.Route.Http.Hosting.dll

Per-route CORS configuration applied by the shared HTTP server's dispatch middleware.
All fields are immutable. The middleware enforces the wildcard-with-credentials rule
at request time regardless of which field the origin came from.

public sealed record RouteCorsOptions : IEquatable<RouteCorsOptions>

Inheritance

Object→RouteCorsOptions

Implements

Properties

AllowCredentials

Sets Access-Control-Allow-Credentials: true when true.

public bool AllowCredentials { get; init; }

AllowedMethods

Comma-separated list emitted in Access-Control-Allow-Methods

public string? AllowedMethods { get; init; }

AllowedOrigins

Comma-separated whitelist of allowed origins. May contain a single

public string? AllowedOrigins { get; init; }

MaxAgeSeconds

Value emitted in Access-Control-Max-Age. Default 86400 (24h).

public int MaxAgeSeconds { get; init; }

OriginsResolver

Optional per-request resolver. Receives the request and returns

public Func<HttpRequest, string?>? OriginsResolver { get; init; }

Constructors

RouteCorsOptions(string?, string?, bool, Func<HttpRequest, string?>?, int)

Per-route CORS configuration applied by the shared HTTP server's dispatch middleware.