type

HandlerOptions

HTTP API, embedded admin, observability, security, and worker configuration.

Arguments

ArgumentTypeDescription
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.

Full signature

type HandlerOptions struct { // AdminAssets overrides the framework's embedded admin asset filesystem. AdminAssets fs.FS // MaxBodyBytes limits decoded request bodies. Zero uses the framework default. MaxBodyBytes int64 // SecureCookies restricts auth cookies to HTTPS requests. SecureCookies bool // AllowedOrigins lists browser origins permitted by CORS. AllowedOrigins []string // AllowedRequestHeaders appends application-owned CORS request headers to // Ridu's SDK headers. Invalid HTTP token names are ignored. AllowedRequestHeaders []string // AllowedHosts restricts the HTTP Host header. Entries are exact hostnames // with an optional port; an entry without a port accepts any port. Empty // accepts every syntactically valid host for development. Production // deployments should set their public hostnames. AllowedHosts []string // TrustedProxyCIDRs lists proxies whose forwarded client addresses are trusted. TrustedProxyCIDRs []string // TrustedProxyHops 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. TrustedProxyHops int // AuthRateLimit is the maximum auth attempts per identity and client window. AuthRateLimit int // AuthRateWindow is the duration over which AuthRateLimit is enforced. AuthRateWindow time.Duration // Audit receives security-relevant application events. Audit func(AuditEvent) // Observe receives timing and status metadata for completed requests. Observe func(RequestObservation) // RequestError receives trusted diagnostic detail for internal failures and // recovered panics. The HTTP response remains redacted. RequestError func(RequestErrorEvent) // RequestTimeout limits request execution. Zero uses the framework default; // a negative duration disables the handler deadline for streaming plugins. RequestTimeout time.Duration // ReadinessChecks add application/plugin dependencies to /readyz. Checks // must be read-only, repeatable, and honor Context cancellation. ReadinessChecks []ReadinessCheck // ReadinessTimeout bounds the complete database, storage, and custom // readiness probe. Zero uses five seconds; a negative duration disables it. ReadinessTimeout time.Duration // ContentSecurityPolicy overrides the framework admin policy. Empty uses a // conservative default compatible with live-preview frames. ContentSecurityPolicy string // DisableContentSecurityPolicy explicitly disables the admin CSP when an // upstream gateway owns it. DisableContentSecurityPolicy bool // StrictTransportSecurity is emitted verbatim when non-empty. Configure it // only when every public request is HTTPS, normally at the TLS terminator. StrictTransportSecurity string // TaskInterval controls how often the durable task queues are polled. Zero // uses the framework default. TaskInterval time.Duration // TaskBatch limits durable task leases claimed during one polling cycle. TaskBatch int // TaskQueues optionally restricts this process to named queues. An empty // list consumes every queue, including unknown task slugs so they can be // moved to a stable terminal failure. TaskQueues []string // TaskLeaseDuration is extended by heartbeats while a handler is running. TaskLeaseDuration time.Duration // TaskHeartbeatInterval must remain shorter than TaskLeaseDuration. TaskHeartbeatInterval time.Duration // TaskPruneBatch bounds terminal records removed after their retention. TaskPruneBatch int // AuthPruneBatch bounds expired sessions and API keys removed from each // durable credential family during one background maintenance cycle. AuthPruneBatch int // JobError receives failures from scheduled background work. JobError func(error) // contains filtered or unexported fields }

Source core/http.go:25

Related types