middleware

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSPNonce

func CSPNonce(c echo.Context) string

CSPNonce returns the request-scoped CSP nonce set by SecurityHeaders middleware.

func LogRequest

func LogRequest(logger *slog.Logger) echo.MiddlewareFunc

LogRequest is a middleware that logs each request using slog. This is often handled by slog-echo, but we can add custom logic here if needed.

func RequestID

func RequestID() echo.MiddlewareFunc

RequestID returns a middleware that adds a request ID to the request and response. It also adds the request ID to the context for slog.

func SecurityHeaders

func SecurityHeaders(cfg config.SecurityConfig, appEnv string) echo.MiddlewareFunc

SecurityHeaders adds baseline secure defaults, including CSP with request-scoped nonce.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL