tell apache to push xenforo.js.gz instead of compressing it each time

Marcus

Well-known member
How can I tell apache to generally get the .gz static files available and only compress files when there is no .gz file available. xenforo.js is 4% larger when dynamically compressed by apache than with 7zip, this is not so much. But there might be an additional speed difference if apache does not need to compress static files.
 
As far as I can see, there is only the option of disabling Gzip by adding this to config.php:

PHP:
$config['enableGzip'] = false;
 
Thanks, I forgot to disable gzip in xenforo. Apache is set to gzip I don't know if it is faster to let apache do the job or php.

Do you know how to tell apache to serve existing filename.gz files instead of taking filename and gzipping it itself?
 
Look at MultiViews and AddEncoding to enable Apache to serve static content if the .gz version exists...
 
Do you know how to tell apache to serve existing filename.gz files instead of taking filename and gzipping it itself?
Using Apache 2 you can use something like the following in your httpd.conf or .htaccess
Code:
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
The "AddOutputFilterByType" directive should be your friend ;)
 
Thanks, but this does not tell my server to fetch the .gz file. Are there other options I have to activate? This is what I want to achieve. This is in my directory

- xenforo.js
- xenforo.js.gz

The browser requests xenforo.js
My server gives him the xenforo.js.gz file from the directory

That is how it works now:
The browser requests xenforo.js
My server compresses xenforo.js and serves xenforo.js.gz (live build)
 
You need Multiviews enabled on the Options line and specific AddEncoding entries.
 
This is my httpd.conf
Options FollowSymLinks MultiViews

#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz

# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
#AddType application/x-compress .Z
#AddType application/x-gzip .gz .tgz
 
Top Bottom