Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Is it possible to load data files from KeyCDN

Discussion in 'WebGL' started by monark, Apr 21, 2016.

  1. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    We would like to serve up the data files for the WebGL player from KeyCDN but so far not having much luck.
    Has anyone managed to do this?
     
  2. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    We are finding that we can serve uncompressed files but despite setting all the configurations for gzip that is failing.
    So it seems like it should be possible...
     
  3. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    This seems to be a general issue with all CDN servers we've not yet found a way to make any work.
     
  4. OminStyle

    OminStyle

    Joined:
    Mar 18, 2013
    Posts:
    15
    I'm currently using WebGL builds with Amazon S3 and Cloudfront. Prior to Unity 5.2 (can't remember the exact version), I had to manually set the configurations for gzip but now it's as simple as drag and drop.
     
  5. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    We have found that if we load the entire project from a cdn then that is ok, but if you try and just load the data files from there and not everything else then it fails.
    We're are still looking into how to get around that
     
  6. srmatthe

    srmatthe

    Joined:
    May 15, 2016
    Posts:
    11
    I use KeyCDN to serve our compressed data, mem and js files.

    I ended up having to use a Pull zone rather than a Push one as you couldn't control the header and the rewrite on a Push zone.

    Set up your origin server as normal and use the .htaccess file provided by the build to rewrite .data to .datagz and to add the gzip encoding in the header.
    Set up the Pull zone in KeyCDN to point to your origin server.
    KeyCDN will adhere to the rules in the .htaccess file and fetch the .datagz file as if it were .data along with acknowledging the gzip encoding. When requested from the CDN the .datagz file will now be passed on as .data with gzip encoding header and the loader doesn't fail back ;)
     
  7. DimensionU

    DimensionU

    Joined:
    Aug 1, 2013
    Posts:
    43
    @monark - Did you find a solution?
     
  8. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    We ended up switching to Amazon S3 and to use that you gzip the files and then remove the .gz extension.
    When you upload them you then add a Content-Encoding header set to gzip.