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

gzip #138

Closed
matteofigus opened this issue Nov 4, 2015 · 6 comments
Closed

gzip #138

matteofigus opened this issue Nov 4, 2015 · 6 comments

Comments

@matteofigus
Copy link
Member

So it would be cool to have all js and css gzipped by default. In case, we may want to have a setting to disable it on the component level? (not sure it is needed).

Gzip support: http://schroepl.net/projekte/mod_gzip/browser.htm

@andyroyle
Copy link
Collaborator

I guess this could be as simple as including the compression module: https://github.com/expressjs/compression

@matteofigus
Copy link
Member Author

Well I want gzip also on compiled views and css and js files during packaging. We already use tar.gz as dependency to do other stuff, if we gzip the stuff before uploading to cdn too then this should be a good win

@matteofigus matteofigus self-assigned this Nov 12, 2015
@andyroyle
Copy link
Collaborator

So what's the idea for the CSS/JS. If we gzip it and throw it onto the CDN during publish, how do we reference it in the browser?

How do we tell the CDN to transfer the content with the correct type?

@matteofigus
Copy link
Member Author

So, in theory we reference it in the same way and we publish it in the same way using the usual Content-Type header (depending on file's type). Then, we need to ensure content comes back from CDN with an additional Accept-Encoding: gzip header (the browser should handle it). It doesn't look like a tricky thing to do as soon as we define a standard and simple way to do it.

@andyroyle
Copy link
Collaborator

"You also need to develop your application to intercept viewer requests and change the request URL based on whether the request includes an Accept-Encoding: gzip header."
...
"Your application determines that Accept-Encoding: gzip appears in the request header and changes the CloudFront URL to request the compressed version of the file."

For requesting the template, that would probably be OK, the registry can just say 'if the client supports gzip then add the .gz extension to the template path'. But for static css/js assets (referenced from template.js) then it's going to be nasty.

@matteofigus
Copy link
Member Author

Closing this as is solved.

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