type
HandlerOptions
HTTP security, size bounds, observers, and trusted-proxy policy.
AdminAssetsfs.FS- Overrides the framework’s embedded admin asset filesystem.
MaxBodyBytesint64- Limits decoded request bodies; zero uses the framework default.
SecureCookiesbool- Restricts authentication cookies to HTTPS requests.
AllowedOrigins[]string- Lists browser origins permitted by credentialed CORS.
AllowedRequestHeaders[]string- Appends application-owned CORS request headers; invalid HTTP token names are ignored.
AllowedHosts[]string- Restricts Host to exact hostnames with optional ports; empty accepts syntactically valid development hosts.
TrustedProxyCIDRs[]string- Lists proxies whose forwarded client addresses may be trusted.
AuthRateLimitint- Sets maximum auth attempts per identity and client window.
AuthRateWindowtime.Duration- Sets the auth-attempt window.
Auditfunc(AuditEvent)- Receives security-relevant application events.
Observefunc(RequestObservation)- Receives timing and status metadata for completed requests.
RequestErrorfunc(RequestErrorEvent)- Receives trusted diagnostic detail while public responses remain redacted.
RequestTimeouttime.Duration- Limits request execution; zero uses the default and a negative value disables the bound.
ReadinessChecks[]ReadinessCheck- Adds read-only repeatable dependencies to /readyz.
ReadinessTimeouttime.Duration- Bounds the complete readiness probe; zero uses five seconds and a negative value disables it.
ContentSecurityPolicystring- Overrides the embedded admin CSP.
DisableContentSecurityPolicybool- Disables CSP when an upstream gateway owns it.
StrictTransportSecuritystring- Emits the configured HSTS value when every public request is HTTPS.
TaskIntervaltime.Duration- Controls durable-task polling frequency.
TaskBatchint- Limits leases claimed during one polling cycle.
TaskQueues[]string- Restricts this process to named worker queues; empty consumes every queue.
TaskLeaseDurationtime.Duration- Sets the lease extended while a handler runs.
TaskHeartbeatIntervaltime.Duration- Sets heartbeat cadence and must be shorter than the lease.
TaskPruneBatchint- Bounds expired terminal task records removed per cycle.
AuthPruneBatchint- Bounds expired sessions and API keys removed per maintenance cycle.
JobErrorfunc(error)- Receives failures from scheduled background work.
Pass this value to App.Handler when embedding Ridu, or install it with WithHandlerOptions when Execute owns the server.
The zero value is development-friendly. Before production, set SecureCookies and AllowedHosts, add AllowedOrigins only for cross-origin browser clients, and trust only proxy ranges you operate. Body, request, readiness, worker, and maintenance bounds resolve independently when left at zero.
Example
options := ridu.HandlerOptions{
SecureCookies: true,
AllowedHosts: []string{"cms.example.com"},
AllowedOrigins: []string{"https://app.example.com"},
RequestTimeout: 15 * time.Second,
}