-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Request for gzip Compression for HTML / CSS / JS #92
Comments
There is a paste middleware that does this, but it is quite limited: You are not the only one that requested such a feature. I'll try to add this to the core. |
recently, we released a wsgi gzip middleware. it only compresses selected types of contents. also it is small and easy to configure. check it out at http://code.google.com/p/ibkon-wsgi-gzip-middleware/ . |
I know this is quite an old issue, but I think that GZIP is out of the purview of Bottle, and should be handled by middleware, similar to how authentication is handled by a middleware. In fact, wouldn't Flup be well suited for this? EDIT: Looks like those modules were removed. |
For a reason, I suppose. It is not that easy to get compression right. You need to:
And many other edge cases I don't remember. I currently do not now a WSGI middleware that does all this in a satisfying way. It is usually better solved by a web-server module (lighttpd+mod_compress or Apache+mod_deflate). Since 512048b, static_file adds a If you only want to speed up some big CSS and JavaScript files, you could compress them manually and add some logic to your static-file route: @route('/static/:filename#.*#') This searches for a file with a '.gz' extension and returns that if the browser supports it. If not, the uncompressed file is returned. If done right, something like this could be added to the core I suppose. Pior [1] played with that Idea some time ago. His branch is still interesting. |
Agreed. I think re-inventing the wheel to solve all these edge cases is a waste of resources, it would be much better to document the advantages and disadvantages to WSGI middleware, and then also mention web-server modules that implement it better, while linking some middleware projects in the docs. I'd be happy to implement that. |
I am awaiting your pull request :) (and closing this issue) |
Actually, could you reopen it? That way when you merge the pull request you can put in a "closes #92" in the message and it'll link up the history. |
Sorry for the noise, rebased off your master then pushed again. I'm rushing too much and getting sloppy. |
sighs - Ok - this time |
I'd like to see optional gzip compression in Bottle, mainly because I have some bigger static JavaScripts in my project. If you reject this request, maybe you could give me a hint where it would be best to add this functionality?
Thanks in advance.
Thomas
The text was updated successfully, but these errors were encountered: