0

I have a virtual host and have enabled AllowOverride All. I know this works since the rewrite rules within the /var/www/site/web/.htaccess are being executed (It's a Symfony app). However when I have a DEFLATE rule in there it doesn't work. For example simply:

AddOutputFilterByType DEFLATE application/json

However if I put this into my virtual host configuration it works. This looks like:

/etc/apache2/sites-enabled/site.dev.conf

<VirtualHost *:80>
    ServerName site.dev

    DocumentRoot /var/www/site/web

    <Directory /var/www/site/web>
        AllowOverride All
        Require all granted
    </Directory>

    # Setup passthrough to phm-fpm and auth header fix
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/site/web/$1
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

    ErrorLog /var/log/apache2/site_error.log
    CustomLog /var/log/apache2/site_access.log combined
</VirtualHost>

Any suggestions as to why this isn't working? I know that it's best to have such rules applied within the virtual host or better still the main apache config. But I am just curious as to why it's not working when placed within the .htaccess

This is running Apache 2.4

HBruijn
  • 72,524
  • 21
  • 127
  • 192
Malachi
  • 441
  • 2
  • 9
  • 18

1 Answers1

0

You're proxying, so there is no filesystem directory involved, so you can't put anything in htaccess and have it actually be used.

Why would you bother with setting up DEFLATE in htaccess if you can edit the real configuration?

If you insist on using htaccess, you can use the the SetHandler method of configuring mod_proxy_fcgi.

covener
  • 1,665
  • 9
  • 15