From 48b6fcf4c5df9e187ba1e9b44800f62436ad9f65 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 17 Sep 2018 21:23:57 +0200 Subject: [PATCH] Support gzip compression on server Signed-off-by: Knut Ahlers --- cmd/serve.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/serve.go b/cmd/serve.go index a377195..96f94c2 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -8,6 +8,8 @@ import ( "os/signal" "github.com/Luzifer/expose/ngrok2" + http_helper "github.com/Luzifer/go_helpers/http" + "github.com/spf13/cobra" ) @@ -43,7 +45,7 @@ var serveCmd = &cobra.Command{ return fmt.Errorf("Unable to create tunnel: %s", err) } - go http.Serve(listener, http.FileServer(http.Dir("."))) + go http.Serve(listener, http_helper.GzipHandler(http.FileServer(http.Dir(".")))) fmt.Printf("Created HTTP server for this directory with URL %s\nPress Ctrl+C to stop server and tunnel", tun.PublicURL) c := make(chan os.Signal, 1)