Git Product home page Git Product logo

Comments (18)

toastal avatar toastal commented on May 3, 2024 2

Derp. So it wasn't this module. The output of the bro command to a *.br file doesn't have read permissions. Sorry about that--I saw the files in the directory and assumed the command would transfer permissions.

from ngx_brotli.

PiotrSikora avatar PiotrSikora commented on May 3, 2024

I cannot replicate this (neither with vanilla nginx-1.9.7 nor with ngx_openresty-1.9.7.1).

What website are you testing this with? Do you have any proxies or CDN in between?

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

I was testing my personal page placeholder @ https://toast.al/ . There's no proxies/CDN between my content and the user. According to my config, the HTML and CSS should be using brotli. I also have gzip and brotli static both enabled.. with %f.gz & %f.br files in the directory.

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

Actually, here's the relevant Nginx config lines:

    ...

    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_static on;

    brotli on;
    brotli_types text/html text/css text/javascript application/javascript application/json image/svg+xml;
    brotli_static on;

    ...

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

If it helps, here's my source for the site as well as my build steps for the server in the README: https://bitbucket.org/toastal/toast.al-social-page/src

from ngx_brotli.

PiotrSikora avatar PiotrSikora commented on May 3, 2024

Are you sure that your web application doesn't send compressed (read: gzipped) responses?

ngx_brotli doesn't re-compress already compressed responses, so if it's gzipped before reaching nginx, it will be passed to the client as such.

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

I'm not 100% sure what you're asking about compressed responses and apps...

The two files are static, an index.html file and a main.css file. There's no app being proxied to or anything like that. Both files however do have a precompressed version for gzip_static and brotli_static.

The dist directory being served from looks like this currently:

Σ /v/w/t/dist (master=) tree .
.
├── css
│   ├── main.css
│   ├── main.css.br
│   └── main.css.gz
├── fonts
│   └── fantasque-sans-mono
│       ├── FantasqueSansMono-BoldItalic.woff
│       ├── FantasqueSansMono-BoldItalic.woff2
│       ├── FantasqueSansMono-Bold.woff
│       ├── FantasqueSansMono-Bold.woff2
│       ├── FantasqueSansMono-Italic.woff
│       ├── FantasqueSansMono-Italic.woff2
│       ├── FantasqueSansMono-Regular.woff
│       └── FantasqueSansMono-Regular.woff2
├── index.html
├── index.html.br
├── index.html.gz
└── robots.txt

3 directories, 15 files

from ngx_brotli.

PiotrSikora avatar PiotrSikora commented on May 3, 2024

Well, I don't know your nginx.conf (can you share it, please? Ideally, just minimal version that you're able to replicate this with), so I'm trying to guess what might be the source of this weird behavior.

Brotli takes precedence over gzip in all my tests...

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024
worker_processes  4;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_static on;

    brotli on;
    brotli_types text/html text/css text/javascript application/javascript application/json image/svg+xml;
    brotli_static on;

    server_tokens off;

    server {
        listen       80;
        server_name  toast.al;
        rewrite ^ https://$server_name$request_uri? permanent;
    }


    # HTTPS server

    server {
        listen       443 default_server ssl http2;
        server_name  toast.al;

        add_header X-Frame-Options SAMEORIGIN;
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Content-Type-Options nosniff;
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

        ... ssl stuff ...

        location / {
            root  /var/www/toast.al-social-page/dist;
            index index.html index.htm;
        }
    }

    server {
       listen 80;
       listen 443 ssl http2;
       server_name www.toast.al;
       return 301  $scheme://toast.al$request_uri;
    }

}

from ngx_brotli.

PiotrSikora avatar PiotrSikora commented on May 3, 2024

I still cannot replicate this issue, even when using your config...

Could you give me the git commit of ngx_brotli that you've checked out?

Also, could you provide a debug log of the gzipped request?

from ngx_brotli.

angristan avatar angristan commented on May 3, 2024

Ho to set Accept-Encoding: br ?

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

If you're asking "how" to set it from the browser, only the Firefox 44+ and latest dev Chromium (behind a flag) support brotli. You'll need one of the supported browsers and they will add the accepted encoding by default.

from ngx_brotli.

angristan avatar angristan commented on May 3, 2024

Okay I updated Firefox to version 44 and I have this : Accept-Encoding :"gzip, deflate, br"
Is this the good order ?

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

Order shouldn't matter. But if you're interested, it can be modified at about:config rule network.http.accept-encoding.secure.

from ngx_brotli.

angristan avatar angristan commented on May 3, 2024

Thanks. I do I know if my web server is correctly configured with Brotli ?

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

How do you know? You can inspect a resource from Firefox's Network tab that should have the encoding. In the response headers of that resource you should see Content-Encoding: "br".

from ngx_brotli.

angristan avatar angristan commented on May 3, 2024

I don't have it :/
screenshot_01-02-2016_01qdj4hy

from ngx_brotli.

toastal avatar toastal commented on May 3, 2024

headers-brotli Mine's working fine.

from ngx_brotli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.