Permalink
Find file
71 lines (46 sloc) 4.08 KB

Server side configuration for video download

Instructions for configuring and verifying CORS settings for different web servers are below.

If you have any questions, email cdn-help@hola.org, or skype:holacdn

Test CORS using HolaCDN console command

First enable hola_debug. Either by adding url param ?hola_debug=true when accessing the page, or type in console hola_cdn.debug_mode().

Now enter in console:

hola_cdn.test_cors()

The current status of CORS settings will be displayed.

If you see CORS status: full support, your CORS settings are correct. Otherwise, continue following this guide to configure and verify your settings using one of the following guides:

CORS configuration for most web servers

For step by step instructions regarding how to enable CORS on different web servers, see the original CORS documentation. Make sure you add all the required headers (header fields are comma separated), not just '*' referenced in the generic instructions:

  • Access-Control-Allow-Origin: *
  • Access-Control-Allow-Methods: HEAD, GET, OPTIONS
  • Access-Control-Expose-Headers: Content-Range, Date, Etag, Cache-Control, Last-Modified
  • Access-Control-Allow-Headers: Content-Type, Origin, Accept, Range, Cache-Control
  • Access-Control-Max-Age: 600
  • Timing-Allow-Origin: *

After committing the configuration changes, verify it works

Finished with CORS configuration? You can go back to enabling HolaCDN

CORS configuration for Nginx

A sample conf statements is given below. Not that they have to be in the same nested level

  add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Methods' 'HEAD, POST, GET, OPTIONS';
  add_header 'Access-Control-Expose-Headers' 'Content-Range, Date, Etag, Cache-Control, Last-Modified';
  add_header 'Access-Control-Allow-Headers' 'Content-Type, Origin, Accept, Range, Cache-Control';
  add_header 'Access-Control-Max-Age' '600';
  add_header 'Timing-Allow-Origin' '*';

CORS configuration for Amazon AWS

Please refer to these instructions for a step-by-step guide on how to configure and verify CORS for Amazon AWS S3.

For Amazon's official document on setting CORS on S3, see here.

If you're using CloudFront, please refer to Amazon's documentation for to how to configure CloudFront to respect cross-origin resource sharing (CORS).

Finished with CORS configuration? You can go back to enabling HolaCDN

CORS configuration for MaxCDN

Please refer to these instructions for a step-by-step guide on how to setup CORS on MaxCDN.

Finished with CORS configuration? You can go back to enabling HolaCDN

CORS configuration for Fastly

Please refer to these instructions for a step-by-step guide on how to setup CORS on Fastly.

Finished with CORS configuration? You can go back to enabling HolaCDN