Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { // The resources to push. Resources []Resource `json:"resources,omitempty"` // Headers to modify for the push requests. Headers *HeaderConfig `json:"headers,omitempty"` // contains filtered or unexported fields }
Handler is a middleware for HTTP/2 server push. Note that HTTP/2 server push has been deprecated by some clients and its use is discouraged unless you can accurately predict which resources actually need to be pushed to the client; it can be difficult to know what the client already has cached. Pushing unnecessary resources results in worse performance. Consider using HTTP 103 Early Hints instead.
This handler supports pushing from Link headers; in other words, if the eventual response has Link headers, this handler will push the resources indicated by those headers, even without specifying any resources in its config.
func (Handler) CaddyModule ¶
func (Handler) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type HeaderConfig ¶
HeaderConfig configures headers for synthetic push requests.
type Resource ¶
type Resource struct { // Method is the request method, which must be GET or HEAD. // Default is GET. Method string `json:"method,omitempty"` // Target is the path to the resource being pushed. Target string `json:"target,omitempty"` }
Resource represents a request for a resource to push.