Open vpfaulkner opened 1 year ago
Hey @vpfaulkner,
Just wanted to let you know that we are looking at this internally. I'll provide more info when we determine why this doesn't appear to work as expected.
thanks @bollain. Let me know if there is anything else I can do.
hey @vpfaulkner, sorry for the delay on this one. We had a look internally and mapped the error you are seeing to the unminified source code. This error gets thrown when the compressed size of the brotli is less than what we expect to be the maximum compressed size. So potentially we think the file is getting compressed twice, one by us, and once by the server.
We have this guide on how to setup content-encoding in common server setups: https://github.com/PDFTron/Content-Encoding-Samples
Let me know if you get a chance to go over it.
When will the nginx sample file get added to that repo?
Hi @gintechsystems,
Please reach out via our support system for further guidance on Nginx: https://apryse.com/form/request
Dear @bollain,
we have warning message and want to fix in nginx. Is there an official documentation now for nginx, or do we also have to contact the support?
Greetings Andreas
Hi @4kochi,
To correctly set the response header for files that are compressed using Brotli in Nginx, you need to configure Nginx to recognize and serve Brotli compressed files. This involves setting the Content-Encoding header correctly and configuring Nginx to serve the pre-compressed Brotli files.
First ensure you have the Brotli configuration to your Nginx configuration file. For example:
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# Brotli configuration
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types application/wasm application/json text/plain text/css application/javascript application/x-javascript;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
brotli_static on;
try_files $uri $uri/ =404;
}
location ~* \.(wasm|mem)$ {
root /usr/share/nginx/html;
# Serve Brotli files if they exist
try_files $uri.br $uri =404;
# Add Brotli header for .br files
if ($http_accept_encoding ~* br) {
add_header Content-Encoding br;
}
}
}
}
More reference on the NGINX headers module here
This is of course a very basic example and intended only to get you started. Running this on my end on a simple app I no longer see the warnings for content encoding, but you will need to tweak this to your configuration and ensure everything works as expected. If you need further guidance please don't hesitate to post here or send a ticket via our support channel.
WebViewer version 8.10.0
The current behavior We get this console warning:
webviewer-core.min.js:215 There may be some degradation of performance. Your server has not been configured to serve .gz. and .br. files with the expected Content-Encoding. See http://www.pdftron.com/kb_content_encoding for instructions on how to resolve this.
However, from what I can tell, the
Content-Encoding
header is being set tobr
Also, if I set a Chrome debugger to the line that throws that warning and look at the response, it includes the expected header:
The expected behavior
No warning
Steps to reproduce
Not sure best way for you to reproduce this.