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 gzip compression, can be enabled/disabled in config.js #2687

Merged
merged 1 commit into from
May 6, 2014
Merged

Add gzip compression, can be enabled/disabled in config.js #2687

merged 1 commit into from
May 6, 2014

Conversation

shindakun
Copy link
Contributor

Closes #1305

  • added compression module
  • added new server config variable: gzip
  • gzip enabled by default in production disabled in other environments

@halfdan
Copy link
Contributor

halfdan commented May 4, 2014

@shindakun The PR is much appreciated - but can we first have a discussion on those topics?

@shindakun
Copy link
Contributor Author

@halfdan certainly, I had already done have the work so I figured I'd make it pretty and submit.

@shindakun
Copy link
Contributor Author

@halfdan Yeah I just noticed npm install compression -save seems to have changed the CRLF.

@shindakun
Copy link
Contributor Author

compress may be a better variable name, since it gets the point across clearly. And your right I didn't need to sprinkle the gzip: false around, since it will be inherently false (falsy?). I'll leave the PR as it is right now, pending further discussions on the matter.

@ErisDS
Copy link
Member

ErisDS commented May 5, 2014

@shindakun Thanks for taking the time to PR this 👍

@shindakun
Copy link
Contributor Author

@ErisDS I'll update my PR this evening after work.

Closes #1305
- added compression module
- added new server config variable: compress
- gzip enabled by default
ErisDS added a commit that referenced this pull request May 6, 2014
Add gzip compression, can be enabled/disabled in config.js
@ErisDS ErisDS merged commit 8a4e0e2 into TryGhost:master May 6, 2014
@twigs67
Copy link

twigs67 commented May 15, 2019

@shindakun gzip is not being applied to image/jpeg and image/png content types. Before I add it to nginx, is there a reason this was left out? Most other file types are encoding via gzip.

@shindakun
Copy link
Contributor Author

@twigs67 heh that was a while ago but if I recall correctly I simply decided to rely on the default filter. It will use a secondary module https://www.npmjs.com/package/compressible which in turn by default only says "textbased" MIME types are compressible.

But, if I was to be faced with this now on my own site... I'd do what you are looking into and let Nginx take care of all the heavy lifting. Though I do think it's redundant to compress png and jpeg since in many cases they are likely already compressed and text is far more likely to "need" compressing.

Smaller transfer sizes are a good thing for everyone though.

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

Successfully merging this pull request may close these issues.

Support for gzip compression
4 participants