middleware

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorsMiddleware

func CorsMiddleware(allowedOrigins []string, next http.Handler) http.Handler

CorsMiddleware handles CORS and OPTIONS preflight requests with optional allowedOrigins. If allowedOrigins is nil or empty, it falls back to getAllowedOrigins(). This middleware intercepts OPTIONS requests only if the Origin header is present and valid, otherwise passing the request to the router (allowing 405/404 responses as appropriate).

Types

type AliasHandler added in v1.0.4

type AliasHandler struct {
	Handler http.Handler
}

AliasHandler provides path aliasing by prepending the inference prefix to incoming request paths.

func (*AliasHandler) ServeHTTP added in v1.0.4

func (h *AliasHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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