fast-twitch.middlewares.x-headers
Complete generated reference for fast-twitch.middlewares.x-headers
Usage and execution boundary
Adds only the configured X response headers. Settings belong in an explicit options map; using this wrapper alone does not enable all defaults/security features.
(ns application.middleware
(:require [fast-twitch.middlewares.x-headers :as middleware]))
(defn handler [_]
{:status 200 :headers {"content-type" "text/plain"} :body "Hello"})
(def app (middleware/wrap-x-headers handler {:content-type-options "nosniff" :frame-options :sameorigin :xss-protection "0"}))
This defines the Ring handler portion. Adapt app through routing/ft-handler or pass it to server/listen!; startup instructions and a complete walkthrough show the surrounding project.
Settings and defaults
| Setting | Meaning |
|---|---|
:content-type-options |
X-Content-Type-Options value |
:frame-options |
X-Frame-Options; supported keyword/string representation |
:xss-protection |
X-XSS-Protection value |
Wrapper order and all middleware families. The function reference below preserves the upstream signatures and source links; helper functions do not all share the wrapper's arity.
Upstream function reference
Adds common hardening headers to outgoing responses.
wrap-x-headers
(wrap-x-headers handler)
(wrap-x-headers handler options)
Function.
Wraps a handler so configured X-* headers are applied to responses. Source
x-headers-response
(x-headers-response response request)
(x-headers-response response _request options)
Function.
Adds configured X-* headers to the response. Source