caddy/middleware/headers/new.go
2015-03-28 16:48:43 -06:00

17 lines
390 B
Go

package headers
import "github.com/mholt/caddy/middleware"
// New constructs and configures a new headers middleware instance.
func New(c middleware.Controller) (middleware.Middleware, error) {
rules, err := parse(c)
if err != nil {
return nil, err
}
return func(next middleware.HandlerFunc) middleware.HandlerFunc {
return Headers{Next: next, Rules: rules}.ServeHTTP
}, nil
}