type

HandlerOptions

HTTP security, size bounds, observers, and trusted-proxy policy.

Example

go
options := ridu.HandlerOptions{
  SecureCookies:  true,
  AllowedHosts:   []string{"cms.example.com"},
  AllowedOrigins: []string{"https://app.example.com"},
  RequestTimeout: 15 * time.Second,
}

Properties

PropertyTypeDescription
AdminAssetsfs.FSOverrides the framework’s embedded admin asset filesystem.
MaxBodyBytesint64Limits decoded request bodies; zero uses the framework default.
SecureCookiesboolRestricts authentication cookies to HTTPS requests.
AllowedOrigins[]stringLists browser origins permitted by credentialed CORS.
AllowedRequestHeaders[]stringAppends application-owned CORS request headers; invalid HTTP token names are ignored.
AllowedHosts[]stringRestricts Host to exact hostnames with optional ports; empty accepts syntactically valid development hosts.
TrustedProxyCIDRs[]stringLists proxies whose forwarded client addresses may be trusted.
TrustedProxyHopsintTrustedProxyHops counts the proxies a request passes through, the one in TrustedProxyCIDRs that connects to Ridu included, when the others can't be listed. For a request from a trusted proxy, Ridu treats the last TrustedProxyHops-1 X-Forwarded-For addresses as proxies too and takes the client address from before them. Use it only when every proxy rewrites or appends to X-Forwarded-For, such as Railway's (2). Zero and one trust only TrustedProxyCIDRs; it has no effect without them.
AuthRateLimitintSets maximum auth attempts per identity and client window.
AuthRateWindowtime.DurationSets 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.DurationLimits request execution; zero uses the default and a negative value disables the bound.
ReadinessChecks[]ReadinessCheckAdds read-only repeatable dependencies to /readyz.
ReadinessTimeouttime.DurationBounds the complete readiness probe; zero uses five seconds and a negative value disables it.
ContentSecurityPolicystringOverrides the embedded admin CSP.
DisableContentSecurityPolicyboolDisables CSP when an upstream gateway owns it.
StrictTransportSecuritystringEmits the configured HSTS value when every public request is HTTPS.
TaskIntervaltime.DurationControls durable-task polling frequency.
TaskBatchintLimits leases claimed during one polling cycle.
TaskQueues[]stringRestricts this process to named worker queues; empty consumes every queue.
TaskLeaseDurationtime.DurationSets the lease extended while a handler runs.
TaskHeartbeatIntervaltime.DurationSets heartbeat cadence and must be shorter than the lease.
TaskPruneBatchintBounds expired terminal task records removed per cycle.
AuthPruneBatchintBounds expired sessions and API keys removed per maintenance cycle.
JobErrorfunc(error)Receives failures from scheduled background work.

How it works

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.

Full signature