From fadf666704b098b37f9c6a0b6aed8a43c9ab213d Mon Sep 17 00:00:00 2001 From: Feuerfuchs Date: Tue, 12 Nov 2019 10:54:47 +0100 Subject: Enable compression with brotli --- gopherproxy.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gopherproxy.go') diff --git a/gopherproxy.go b/gopherproxy.go index 34e6ff8..c91afdf 100644 --- a/gopherproxy.go +++ b/gopherproxy.go @@ -21,6 +21,8 @@ import ( "github.com/gobuffalo/packr/v2" "github.com/davidbyttow/govips/pkg/vips" + + "github.com/NYTimes/gziphandler" ) type Item struct { @@ -382,11 +384,11 @@ func ListenAndServe(bind, robotsfile string, robotsdebug bool, vipsconcurrency i ConcurrencyLevel: vipsconcurrency, }) - http.HandleFunc("/", GopherHandler(tpl, robotsdata, AssetList{styleAsset, jsAsset, fontwAsset, fontw2Asset, propfontwAsset, propfontw2Asset}, robotsdebug, uri)) - http.HandleFunc("/robots.txt", RobotsTxtHandler(robotstxtdata)) - http.HandleFunc("/favicon.ico", FaviconHandler(favicondata)) - http.HandleFunc(styleAsset, StyleHandler(styledata)) - http.HandleFunc(jsAsset, JavaScriptHandler(jsdata)) + http.Handle("/", gziphandler.GzipHandler(GopherHandler(tpl, robotsdata, AssetList{styleAsset, jsAsset, fontwAsset, fontw2Asset, propfontwAsset, propfontw2Asset}, robotsdebug, uri))) + http.Handle("/robots.txt", gziphandler.GzipHandler(RobotsTxtHandler(robotstxtdata))) + http.Handle("/favicon.ico", gziphandler.GzipHandler(FaviconHandler(favicondata))) + http.Handle(styleAsset, gziphandler.GzipHandler(StyleHandler(styledata))) + http.Handle(jsAsset, gziphandler.GzipHandler(JavaScriptHandler(jsdata))) http.HandleFunc(fontwAsset, FontHandler(false, fontdataw)) http.HandleFunc(fontw2Asset, FontHandler(true, fontdataw2)) http.HandleFunc(propfontwAsset, FontHandler(false, propfontdataw)) -- cgit v1.2.3-54-g00ecf