middleware

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 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 V1AliasHandler added in v1.0.3

type V1AliasHandler struct {
	Handler http.Handler
}

V1AliasHandler provides an alias from /v1/ to /engines/v1/ paths

func (*V1AliasHandler) ServeHTTP added in v1.0.3

func (h *V1AliasHandler) 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