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

FAQ out of date? #264

Open
WhyNotHugo opened this issue Nov 1, 2020 · 5 comments
Open

FAQ out of date? #264

WhyNotHugo opened this issue Nov 1, 2020 · 5 comments

Comments

@WhyNotHugo
Copy link

WhyNotHugo commented Nov 1, 2020

Shouldn’t I be pushing my static files to S3 using something like Django-Storages?
No, you shouldn’t. The main problem with this approach is that Amazon S3 cannot currently selectively serve compressed content to your users. Compression (using either the venerable gzip or the more modern brotli algorithms) can make dramatic reductions in the bandwidth required for your CSS and JavaScript. But in order to do this correctly the server needs to examine the Accept-Encoding header of the request to determine which compression formats are supported, and return an appropriate Vary header so that intermediate caches know to do the same. This is exactly what WhiteNoise does, but Amazon S3 currently provides no means of doing this.

Looks like this is out of date. CloudFront supports compressing files, and, since September 2020, supports Brotli compression.

@evansd
Copy link
Owner

evansd commented Nov 2, 2020

Thanks

@gabn88
Copy link

gabn88 commented Nov 25, 2020

@WhyNotHugo
What configuration do you currently use to make it work with CloudFront automatically compressing files? Does CloudFront charge you extra when you add compression?

Edit: Nevermind, I found the message from AWS (from September 15th) that using automatic compression is without extra costs. This is good news, I reverted back to the Django ManifestStatiFileStorage (instead of the compressed one) and now the collectstatic command is much faster and also we have much less files on or version control system, making it faster again 👍

@WhyNotHugo
Copy link
Author

This is good news, I reverted back to the Django ManifestStatiFileStorage (instead of the compressed one) [...]

I missed this comment at the time (there's no email notification if a comment is edited). Thanks for pointing this out, I'm still using CompressedManifestStaticFilesStorage; that's so dumb of me 🤦

@Jsalaz1989
Copy link

Does this mean this part of the docs is also outdated? Do I still need to enable brotli in whitenoise via pip install whitenoise[brotli] or is it all taken care of on the CloudFront side?

According to Amazon:

"CloudFront can compress objects using the Gzip and Brotli compression formats. When the viewer supports both formats, CloudFront prefers Brotli."

@WhyNotHugo
Copy link
Author

WhyNotHugo commented Dec 2, 2021

Does this mean this part of the docs is also outdated?

Yes, a PR for that would be nice. Support for gzip and brotli needs to be enabled on cloudfront too, btw.

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

No branches or pull requests

4 participants