File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,8 @@ func main() {
255255 e := echo .New ()
256256
257257 // Middleware
258+ e .Use (middleware .Secure ())
259+ //e.Use(middleware.Recover())
258260 e .Use (middleware .GzipWithConfig (middleware.GzipConfig {
259261 Skipper : func (c echo.Context ) bool {
260262 skip := []string {
@@ -269,7 +271,6 @@ func main() {
269271 return false
270272 },
271273 }))
272- //e.Use(middleware.Recover())
273274 e .Use (middleware .LoggerWithConfig (middleware.LoggerConfig {
274275 CustomTimeFormat : "2006/01/02 15:04:05" ,
275276 Format : "${time_custom} ${status} ${method} ${latency_human} ${path} (${remote_ip})\n " ,
@@ -299,6 +300,13 @@ func main() {
299300 return next (c )
300301 }
301302 })
303+ // Cache-Control header
304+ e .Use (func (next echo.HandlerFunc ) echo.HandlerFunc {
305+ return func (c echo.Context ) error {
306+ c .Response ().Header ().Set (echo .HeaderCacheControl , "private, max-age=31536000" )
307+ return next (c )
308+ }
309+ })
302310
303311 // API
304312 api := e .Group ("/api" )
You can’t perform that action at this time.
0 commit comments