diff --git a/serverutil/http.go b/serverutil/http.go
index 6a2cc3d1736505fe0ed12339f89a1d458382817b..b2575350bcb11e0099375aee69a3b4f37a3500c7 100644
--- a/serverutil/http.go
+++ b/serverutil/http.go
@@ -89,7 +89,7 @@ func (config *ServerConfig) buildHTTPHandler(h http.Handler) (http.Handler, *tls
 	h = addDefaultHandlers(h)
 
 	// Optionally enable compression.
-	if config.EnableCompression {
+	if config != nil && config.EnableCompression {
 		gzwrap, err := gziphandler.GzipHandlerWithOpts(
 			gziphandler.CompressionLevel(gzipLevel),
 			gziphandler.MinSize(gzipMinSize),