Skip to content
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

Add ability to serve gzip compressed resources #25

Closed
dolfs opened this issue Mar 9, 2018 · 7 comments
Closed

Add ability to serve gzip compressed resources #25

dolfs opened this issue Mar 9, 2018 · 7 comments
Milestone

Comments

@dolfs
Copy link
Contributor

dolfs commented Mar 9, 2018

Using web pack, as we do, it is easy to generate duplicates of various bundles that are gzip-ed and have a name that is identical except for an additional suffix of .gz.

If a request comes in that contains the "Accept-Encoding: gzip" header, it would be nice if we would serve up any .gz version of a resource, if it exists. This does not require building on-the-fly gzip capability into the server.

It would come at the cost of an extra stat call to see if the gz resource exists unless we also have the server build a resource map at startup. Probably not important enough performance wise for now.

@dolfs
Copy link
Contributor Author

dolfs commented Mar 9, 2018

FYI for my current ui-refactor in progress, the .gz variants will reduce overall resource load from 344K to 101K, so it is worthwhile.

@scottlamb
Copy link
Owner

I agree that'd be a nice bit of polish, though probably not urgent. (If you have bandwidth for video, you probably have bandwidth for the uncompressed files.)

In general, the way the static file serving is done now is kind of silly. It scans for files once at startup; so if you add files to the static file dir while it's serving, it will still say they don't exist. It'd be nicer to have something for serving a directory properly, perhaps added to my http-serve crate. That could check for the .gz variant first if the already-written http_serve::should_gzip function returns true.

I'd also like to support self-contained builds for distribution that bundle all the static files into the binary.

@dolfs
Copy link
Contributor Author

dolfs commented Mar 9, 2018

The urgency argument does not apply if you are trying to check your "stuff" from a mobile out in the field. I do this using a VPN over cellular (because I do not want to expose Moonfire on an extern port).

Having said that, it is still not truly urgent, but a but more important than the "if you have video bandwidth" argument.

@scottlamb
Copy link
Owner

Yeah, fair point. Let's call it milestone-1.0?. (Incidentally, I haven't filed issues for this yet, but I really would like to address for 1.0 the "do not want to expose Moonfire on an external port" thing. It needs user authentication, and it either needs built-in https + letsencrypt support or at least instructions for sticking Apache/nginx in front for https.)

@dolfs
Copy link
Contributor Author

dolfs commented Mar 9, 2018 via email

@scottlamb
Copy link
Owner

Lemme open separate issues for these. I've been thinking a bit about how they might work.

@scottlamb scottlamb added this to the 1.0? milestone Mar 9, 2018
@scottlamb
Copy link
Owner

See #26 (user authentication) and #27 (https). I opened a ton of other issues, too, for most of my mental todo list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants