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

在网站
图片[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;
    }
}

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享