Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Configure server for serving osgjs files

Cedric Pinson edited this page Apr 13, 2016 · 1 revision

It's more efficient to serve gzip files instead of plain text / binary files. In order to have the browser un gzip files correctly you need to adds custom header on your server for .gz files.

example of what I use with nginx:

        location ~ \.gz$ {
                gzip off;
                add_header Content-Encoding 'gzip';
                default_type text/plain;

                add_header Access-Control-Allow-Origin *;
                add_header Access-Control-Allow-Credentials 'true';
                expires 31536000;
                add_header Cache-Control public;
        }

The alternative is to include the gunzip.min.js in your html files then osg will fallback to gunzip in js. This solution is less performant than the server header.

Clone this wiki locally