Files
athens/pkg/middleware/cache_control.go
Marwan Sulaiman a1b5060ead Proxy: add cache-control middleware (#553)
* Proxy: add cache-control middleware

* fix improt cycle + use MDN no-cache example

* remove import lines

* actually use MDN example

* remove .idea from gitignore in unrelated pr
2018-08-22 09:52:16 -04:00

17 lines
472 B
Go

package middleware
import (
"github.com/gobuffalo/buffalo"
)
// CacheControl takes a string and makes a header value to the key Cache-Control.
// This is so you can set some sane cache defaults to certain endpoints.
func CacheControl(cacheHeaderValue string) buffalo.MiddlewareFunc {
return func(next buffalo.Handler) buffalo.Handler {
return func(c buffalo.Context) error {
c.Response().Header().Set("Cache-Control", cacheHeaderValue)
return next(c)
}
}
}