Ensure that gzip is the final middleware to be initialised

This commit is contained in:
Tobie Morgan Hitchcock 2017-11-16 20:49:28 +00:00
parent 8f06b958ff
commit 33ab1efb08

View file

@ -42,7 +42,6 @@ func Setup(opts *cnf.Options) (err error) {
s.Use(mw.Fail()) // Catch panics s.Use(mw.Fail()) // Catch panics
s.Use(mw.Logs()) // Log requests s.Use(mw.Logs()) // Log requests
s.Use(mw.Sock()) // Log requests s.Use(mw.Sock()) // Log requests
s.Use(mw.Gzip()) // Gzip responses
// Add trace information // Add trace information
@ -82,6 +81,10 @@ func Setup(opts *cnf.Options) (err error) {
AllowedLength: 1 << 20, // 1mb AllowedLength: 1 << 20, // 1mb
})) }))
// Compress responses
s.Use(mw.Gzip())
// Log successful start // Log successful start
log.WithPrefix("web").Infof("Started web server on %s", opts.Conn.Web) log.WithPrefix("web").Infof("Started web server on %s", opts.Conn.Web)