caddy: github.com/mholt/caddy/caddyhttp/header Index | Files

package header

import "github.com/mholt/caddy/caddyhttp/header"

Package header provides middleware that appends headers to requests based on a set of configuration rules that define which routes receive which headers.

Index

Package Files

header.go setup.go

type Headers Uses

type Headers struct {
    Next  httpserver.Handler
    Rules []Rule
}

Headers is middleware that adds headers to the responses for requests matching a certain path.

func (Headers) ServeHTTP Uses

func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP implements the httpserver.Handler interface and serves requests, setting headers on the response according to the configured rules.

type Rule Uses

type Rule struct {
    Path    string
    Headers http.Header
}

Rule groups a slice of HTTP headers by a URL pattern.

Package header imports 4 packages (graph) and is imported by 108 packages. Updated 2019-07-02. Refresh now. Tools for package owners.