-
Notifications
You must be signed in to change notification settings - Fork 896
feat: gzip static http server assets #2272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Agent binary downloads go from 30MB to 13MB!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I was thinking we should do this as I was investigating #2202, glad you got around to it!
PS. I don't think the use of middleware here is a blocker (i.e. we can go ahead with gziphandler
), but I do think supporting more than gzip may be beneficial in the browser environment (considering we're serving the entire site package behind the handler).
coderd/coderd.go
Outdated
@@ -350,7 +351,8 @@ func New(options *Options) *API { | |||
r.Get("/state", api.workspaceBuildState) | |||
}) | |||
}) | |||
r.NotFound(api.siteHandler.ServeHTTP) | |||
|
|||
r.NotFound(gziphandler.GzipHandler(http.HandlerFunc(api.siteHandler.ServeHTTP)).ServeHTTP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to prefer gziphandler
vs chi/middleware.Compress
here? The Chi one also supports deflate
. (I think it would be nice to support all of: deflate, gzip and br (brotli), but chi does not handle br.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that one looks better!
We should def remove this once we start to actually store gzip'd assets, but this is a pretty quick win especially when using the dev tunnel. |
Agent binary downloads go from 30MB to 13MB!