Cross-origin access

Updated at:

This topic explains how to configure cross-origin access.

Cross-origin access for H5 video (FLV and M3U8)

If you encounter the following error, enable cross-origin access for the playback domain name.

No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:9030‘ is therefore not allowed access.

Add an HTTP header to allow cross-origin access. Set the value to the domain name of the website where the video plays. For example, if the website is https://www.aliyun.com, set the value to https://www.aliyun.com.

Procedure

  1. Log in to the Vision Compute console.

  2. In Space Management, access your space, click Space Configuration, find the playback domain name, and click Domain Name Configuration.

  3. Select Cache Configuration and click Add HTTP Header. From the parameter drop-down list, select Access-Control-Allow-Origin.

In the Add HTTP Header Settings dialog box, enter the origin domain name in the Value field, such as https://www.aliyun.com, and then click OK.

Note

If the domain name of a TS segment is different from the domain name of the M3U8 file, you must also add the cross-origin access HTTP header for the TS segment's domain.