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 assets GZIP compression with Apache #6650
Comments
@luke- if you think it's a good idea, I can send a PR. |
You should attach gzip to event handlers on Response, instead of doing this in the |
@ArchBlood Thanks. I've founded this about your recommendation: https://stackoverflow.com/a/36705085 However, I've had a look to other Humhub instances I manage and files are already compressed! @luke- Do you know what to do to have gzip compression on assets?
|
@marc-farre It would probably be best, at least for the time being, to include notes and sample configurations in our wiki: https://community.humhub.com/s/installation-and-setup/wiki/Performance+and+scaling With our cloud hosting, for example, compression is handled by the front-end proxy (NGINX). Apart from that, we should perhaps include compression in the ".htaccess" or NGINX example configuration. |
Personally the event handler is the best option here with a check to make sure that GZip Extensions Check // Checks GZip Extensions
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'GZip']);
if (class_exists('gzencode' && 'gzcompress' && 'gzfile' && 'ob_gzhandler' && 'Phar::compress')) {
$checks[] = [
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => $title,
'state' => 'ERROR',
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'PHP GZip'])
];
} If any of the gzip extensions aren't installed then GZip would be counterproductive if this were implemented anyway. As for your other question, you can group asset bundles, but this would require a lot of work because you have to define each asset bundle into a group, I believe Yii has this documented in their docs. |
@ArchBlood Thanks for the example. All files from the |
This is done in |
@marc-farre Thanks! |
Is your feature request related to a problem? Please describe.
Without compression, a Humhub page loads for about 4,5 Mb of files.
With Apache compression, it's reduced to 2,5 Mb.
E.g. the
humhub-bundle.js
is 1,5 Mb. When sent with Apache GZIP compression, it's only 455 Kb.Describe the solution you'd like
Add this to the
.htaccess
file:The text was updated successfully, but these errors were encountered: