I can't set up nginx 1.18 (Ubuntu 22.04 as a server env, Chrome 104 as a client) for dealing with .br
or .gz
files.
My frontend code bundler (Parcel 2) has generated .br
and .gz
index.html files but when I'm trying to access https://mysite/index.html it throws 404 Not found
, and with https://mysite/index.html.br it's just trying to download Brotli
file.
My assumption is that Nginx should send .br
or .gz
file to Chrome and Chrome should automatically extract it to regular html-file and display web page. Is it right or not?
This is an extract from my nginx.conf
:
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
...
...
...
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
brotli on;
brotli_static on;
brotli_types
text/plain
text/css
text/xml
text/javascript
text/x-component
application/xml
application/xml+rss
application/javascript
application/json
application/atom+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-font-opentype
application/x-font-truetype
application/x-web-app-manifest+json
application/xhtml+xml
application/octet-stream
font/opentype
font/truetype
font/eot
font/otf
image/svg+xml
image/x-icon
image/vnd.microsoft.icon
image/bmp;
This is server conf:
...
location ~* \.(js|jpg|png|jpg|jpeg|git|ico|css|eot|woff|woff2|svg|webmanifest)$ {
root /var/www/main;
try_files $uri $uri/ /webgl$uri =404;
}
location / {
root /var/www/main/webgl;
try_files $uri $uri/ =404;
}
...
What I have to do? Thank you!