Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidHost = errors.New("rewrite host has invalid type")
View Source
var RewriteHostKey rewriteKeyType = "__uncors_rewrite_host"
RewriteHostKey is a key used to store host rewriting configuration in the request context.
Functions ¶
func GetRewriteHost ¶
GetRewriteHost extracts the rewrite host value from the request context. It returns the host string and any error encountered during extraction. If no host value is found in the context, it returns an empty string and nil error. If the value exists but is not a string, it returns ErrInvalidHost.
func IsRewriteRequest ¶
IsRewriteRequest checks if the provided request contains a rewrite host in its context. It returns true if the request has a rewrite host value set under RewriteHostKey, false otherwise.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(options ...MiddlewareOption) *Middleware
type MiddlewareOption ¶
type MiddlewareOption = func(*Middleware)
func WithRewritingOptions ¶
func WithRewritingOptions(rewrite config.RewritingOption) MiddlewareOption
Click to show internal directories.
Click to hide internal directories.