kjdev / php-ext-brotli

Brotli Extension for PHP
MIT License
172 stars 29 forks source link

Name collision with br(azilian) language on php-fpm? #13

Open maniac0s opened 5 years ago

maniac0s commented 5 years ago

For some reason I need to remove Brazilian language from mime.conf when using brotli.so with php-fpm so it doesn't get send as content-language br

When I have in my mime.conf: AddLanguage .br

And add br compression for .css to Drupal, I get the following response headers for the aggregated .css (and only the headers that are aggregated by php in Drupal):

accept-ranges: bytes cache-control: max-age=31449600, no-transform, public, immutable content-encoding: br content-language: br content-length: 1891 content-type: text/css date: Fri, 26 Oct 2018 11:50:11 GMT expires: Fri, 25 Oct 2019 11:50:11 GMT last-modified: Fri, 26 Oct 2018 11:45:05 GMT server: Apache status: 200 vary: Accept-Encoding

when I add RemoveLanguage br to mime.config, the content-language header field disappears.

The encoding works however it doesn't seem to make sense to have a content-language br for css files just because I deliver brotli.

kjdev commented 5 years ago

We have implemented an experimental output handler with version 0.6.0

<?php
ini_set('brotli.output_compression', 'On');

echo ...;

Request Header

Accept-Encoding: gzip, deflate, br

Response Header

Content-Encoding: br
Vary: Accept-Encoding
Transfer-Encoding: chunked
Server: nginx/1.12.1
X-Powered-By: PHP/7.2.12