Skip to content
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

BR content-encoding only works with static files like .css .js #30

Closed
draft1 opened this issue Jul 28, 2016 · 12 comments

Comments

@draft1
Copy link

commented Jul 28, 2016

But not working on full html pages.

My config:

brotli on;
brotli_static on;
brotli_min_length 1000;
brotli_buffers 32 8k;
brotli_comp_level 5;
brotli_types text/plain text/css text/xml application/javascript application/x-javascript application/xml application/xml+rss application/ecmascript application/json image/svg+xml;

@redburn

This comment has been minimized.

Copy link

commented Aug 13, 2016

HTML pages are served with MIME type text/html, which is missing from brotli_types in your config.

@draft1

This comment has been minimized.

Copy link
Author

commented Aug 13, 2016

But it was stated on your docs that:

Responses with the text/html MIME type are always compressed.

@redburn

This comment has been minimized.

Copy link

commented Aug 13, 2016

Oh, my bad. Perhaps this issue #22 is relevant?

@draft1

This comment has been minimized.

Copy link
Author

commented Aug 13, 2016

Almost identical but I don't have full page caching enabled.
Even for logged visitors still not showing br encoding for php/html pages.

@PiotrSikora

This comment has been minimized.

Copy link
Member

commented Aug 13, 2016

Sorry, but you didn't provide any useful information.

Could you paste output of:

curl -vso /dev/null -H"Accept-Encoding: gzip, br" http://path/to/your.html

?

And, ideally, the same curl against your backend server (not NGINX)?

@draft1

This comment has been minimized.

Copy link
Author

commented Aug 14, 2016

From my desktop:
`curl -vso /dev/null -H"Accept-Encoding: gzip, br" https://domain.com/

  • Trying 1.2.3.4...
  • Connected to domain.com (1.2.3.4) port 443 (#0)
  • found 173 certificates in /etc/ssl/certs/ca-certificates.crt
  • found 704 certificates in /etc/ssl/certs
  • ALPN, offering http/1.1
  • SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
  • server certificate verification OK
  • server certificate status verification SKIPPED
  • common name: domain.com (matched)
  • server certificate expiration date OK
  • server certificate activation date OK
  • certificate public key: RSA
  • certificate version: #3
  • subject: OU=Domain Control Validated,OU=PositiveSSL,CN=domain.com
  • start date: Thu, 10 Mar 2016 00:00:00 GMT
  • expire date: Sun, 10 Mar 2019 23:59:59 GMT
  • issuer: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
  • compression: NULL
  • ALPN, server accepted to use http/1.1

    GET / HTTP/1.1
    Host: domain.com
    User-Agent: curl/7.47.0
    Accept: /
    Accept-Encoding: gzip, br

    < HTTP/1.1 200 OK
    < Server: nginx
    < Date: Sun, 14 Aug 2016 03:41:06 GMT
    < Content-Type: text/html; charset=UTF-8
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < Expires: Thu, 19 Nov 1981 08:52:00 GMT
    < Cache-control: private, max-age=0
    < Set-Cookie: xf_session=804fdaf5f3d2a16b935656d039576131; path=/; secure; HttpOnly
    < X-Frame-Options: SAMEORIGIN
    < Content-Encoding: gzip
    < Vary: Accept-Encoding
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    < Strict-Transport-Security: max-age=31536000; includeSubdomains;
    <
    { [872 bytes data]
  • Connection #0 to host domain.com left intact
    `

I'm not using any other backend server, just pure Nginx.

@draft1

This comment has been minimized.

Copy link
Author

commented Aug 14, 2016

From the server itself:
`# curl -vso /dev/null -H"Accept-Encoding: gzip, br" https://domain.com/

  • About to connect() to domain.com port 443 (#0)
  • Trying 1.2.3.4...
  • Connected to domain.com (1.2.3.4) port 443 (#0)
  • Initializing NSS with certpath: sql:/etc/pki/nssdb
  • CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
  • SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • Server certificate:
  • subject: CN=domain.com,OU=PositiveSSL,OU=Domain Control Validated
  • start date: Mar 10 00:00:00 2016 GMT
  • expire date: Mar 10 23:59:59 2019 GMT
  • common name: domain.com
  • issuer: CN=COMODO RSA Domain Validation Secure Server CA,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB

GET / HTTP/1.1
User-Agent: curl/7.29.0
Host: domain.com
Accept: /
Accept-Encoding: gzip, br

< HTTP/1.1 200 OK
< Server: nginx
< Date: Sun, 14 Aug 2016 03:43:51 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-control: private, max-age=0
< Set-Cookie: xf_session=cdbfa6768c8ff303a71e4e2f1a58dccd; path=/; secure; HttpOnly
< X-Frame-Options: SAMEORIGIN
< Content-Encoding: gzip
< Vary: Accept-Encoding
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000; includeSubdomains;
<
{ [data not shown]

  • Connection #0 to host domain.com left intact
    `
@PiotrSikora

This comment has been minimized.

Copy link
Member

commented Aug 16, 2016

I'm not using any other backend server, just pure Nginx.

Uhm, there is xf_session cookie in the response headers, so there is definitely something more than just NGINX...

Anyway, it looks that your backend compresses response with gzip (and NGINX doesn't recompress it with Brotli, by design).

Could you try adding:

proxy_set_header "Accept-Encoding" "";

to your proxy location, so that backend doesn't see Accept-Encoding header?

@redburn

This comment has been minimized.

Copy link

commented Aug 16, 2016

https://xenforo.com/help/config-php-options/

enableGzip is set to true by default. Change it to false to have nginx
(instead of PHP) handle the compression of text/html responses.

@draft1

This comment has been minimized.

Copy link
Author

commented Aug 16, 2016

Thanks lot!
Fixed now with this config for XenForo:
$config['enableGzip'] = false;

@centminmod

This comment has been minimized.

Copy link

commented Aug 21, 2016

that's strange my xenforo works with brotli and i didn't need to disable xenforo gzip !

@rugk

This comment has been minimized.

Copy link

commented Aug 21, 2016

that's strange my xenforo works with brotli and i didn't need to disable xenforo gzip !

Have you tested whether XenForo actually uses gzip?
Additionally I think you should disable GZIP there anyway when you compress the files with the webserver as the PHP implementation is quite certainly slower and useless when you use Brotli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.