Nima Masalegooha
Nima Masalegooha

Reputation: 99

Problem enabling Brotli support on Apache


I installed Brotli by

apt install brotli

And enabled brotli module in Apache by:

a2enmod brotli

And added this line on my vhost config:

<IfModule mod_brotli.c>
    AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/vnd.ms-fontobject image/x-icon
</IfModule>

But still can't enable on my website.

What else should I do?

OS: Ubuntu 18 LTS

Upvotes: 1

Views: 1059

Answers (1)

Nima Masalegooha
Nima Masalegooha

Reputation: 99

I found an answer to my problem, in case anyone have similar issue.

SetOutputFilter should be defined before AddOutputFilterByType

Here is a working config:

<IfModule mod_brotli.c>
    SetOutputFilter BROTLI_COMPRESS
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-brotli
    AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/vnd.ms-fontobject image/x-icon
</IfModule>
    

Upvotes: 5

Related Questions