> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/get-started/faq/content-encoding.md).

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

World's #1 PDF SDK Library for Web, Mobile, Server, Desktop

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](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.

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-641c8ecdf29fe424551eba01f8c63b20bc6f1a34%2F41ca5693f3fae1b8638dd788ce2a9abeb4ee4282-896x133.png?alt=media)

### 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`).

{% tabs %}
{% tab title=".htaccess" %}
{% code lineNumbers="true" %}

```htaccess
AddType image/vnd.microsoft.icon .cur
AddType application/json .json
AddType text/cache-manifest .appcache
AddType application/octet-stream .mem
AddType application/octet-stream .res
AddType application/x-pnacl .pexe
AddType application/octet-stream .nmf
AddType application/wasm .wasm

<IfModule mod_headers.c>
    <FilesMatch ".*\.(gz)\..*">
        # Serve correct encoding type.
        # We make the assumption that gzip is always supported.
        Header set Content-Encoding gzip
        # Force proxies to cache gzipped & non-gzipped files separately.
        Header set Vary Accept-Encoding
    </FilesMatch>

    <FilesMatch ".*\.(br)\..*">
        # Serve correct encoding type.
        # Note that we only serve the brotli file with Content-Encoding: br if the client told us it supports it.
        SetEnvIf Accept-Encoding ".*br.*" SUPPORT_BROTLI
        Header set Content-Encoding br env=SUPPORT_BROTLI
        # Force proxies to cache brotli encoded & non-brotli encoded files separately.
        Header set Vary Accept-Encoding
    </FilesMatch>
</IfModule>
```

{% endcode %}
{% endtab %}
{% endtabs %}

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](https://www.iis.net/downloads/microsoft/url-rewrite/).
2. Download [this web.config](https://groups.google.com/group/pdfnet-webviewer/attach/1710cd5181e4c/web.config?part=0.1\&authuser=0) file, and place it in the `core` directory (eg. `WebViewer/lib/core`).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/get-started/faq/content-encoding.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
