转码无法跨域播放(主机头)

在网站
转码无法跨域播放(主机头) nginx 第1张
第一种方法

location / {
    if ( $request_method = 'OPTIONS' ) {
            add_header access-control-allow-headers range;
            add_header access-control-allow-methods GET,POST,HEAD,OPTIONS;
            add_header access-control-allow-origin *;
            return 200;
        }
        add_header access-control-allow-origin *;
}

第二种方法

location / {  
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

    if ($request_method = 'OPTIONS') {
        return 204;
    }
}

 

评论已关闭