Why does WebViewer give a warning about Content-Encoding when loading from my server?

WebViewer contains certain large files that are already compressed using brotli (abbreviated br) or gzip encoding. As the warning suggests for ideal performance your server should be adjusted to serve these files with the HTTP Content-Encoding header. (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding for more details on Content-Encoding).

The main reason for this is that with this header the browser can quickly decompress these files using native code. Note that WebViewer can still function by decompressing these files in JavaScript, but this may have an impact on loading speed.

The second reason that can impact performance is that the workers will have to be fetched twice. This is due to the workers being uncompressed and the JavaScript having to fetch the files to decompress. This can be seen in the network tab of the browser's developer tools and can add a delay to the WebViewer loading time depending on the network speed.

Apryse Docs Image

General Steps

Note that in order to serve files with Content-Encoding: br your site must use HTTPS rather than HTTP. This is due to behaviour in certain browsers (in particular Chrome) that leads them to reject brotli encoding served over HTTP.

The goal is to serve files within WebViewer containing ".gz." in their file name with "Content-Encoding: gzip" and files containing ".br." in their file name with "Content-Encoding: br".

For Apache Servers

We've included the logic below for you, please insert that text into a .htaccess file and place it within the core directory (eg. WebViewer/lib/core).

htaccess

1AddType image/vnd.microsoft.icon .cur
2AddType application/json .json
3AddType text/cache-manifest .appcache
4AddType application/octet-stream .mem
5AddType application/octet-stream .res
6AddType application/x-pnacl .pexe
7AddType application/octet-stream .nmf
8AddType application/wasm .wasm
9
10<IfModule mod_headers.c>
11 <FilesMatch ".*\.(gz)\..*">
12 # Serve correct encoding type.
13 # We make the assumption that gzip is always supported.
14 Header set Content-Encoding gzip
15 # Force proxies to cache gzipped & non-gzipped files separately.
16 Header set Vary Accept-Encoding
17 </FilesMatch>
18
19 <FilesMatch ".*\.(br)\..*">
20 # Serve correct encoding type.
21 # Note that we only serve the brotli file with Content-Encoding: br if the client told us it supports it.
22 SetEnvIf Accept-Encoding ".*br.*" SUPPORT_BROTLI
23 Header set Content-Encoding br env=SUPPORT_BROTLI
24 # Force proxies to cache brotli encoded & non-brotli encoded files separately.
25 Header set Vary Accept-Encoding
26 </FilesMatch>
27</IfModule>

Please make sure that .htaccess files are enabled. Please also make sure that your server has mod_headers enabled.

For IIS

  1. Make sure the URL rewrite module is installed and active. You can download the module here.
  2. Download this web.config file, and place it in the core directory (eg. WebViewer/lib/core).

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales