I believe this would be a more CPU friendly method, can it be implemented with php ?, instead of gzipping content for every request, I compress the files once and serve those instead =).
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, this is quite easy to do with Apache.
Store the uncompressed and compressed files side by side. E.g.:
Enable content negotiation in Apache. Use:
Now when “/javascript” is requested, Apache will serve the gzipped version if the client declares it accepts it (through
Accept-encoding).Example of two HTTP requests (some headers omitted):
Client claims to accept gzip
Client does not claim to accept gzip
See a more complete version here http://pastebin.com/TAwxpngX