推流到流媒体,rtmp播放正常,hls 播放时 Allow-Control-Allow-Origin 怎么处理?
JosonJiang opened this issue · 1 comments
JosonJiang commented
HTTP response code:0 This might be a CORS issue, consider installing Allow-Control-Allow-Origin Chrome Extension
1.065 | A network error occurred: manifestLoadError
NGINX中添加有但是好像没起作用???!
add_header 'Access-Control-Allow-Origin' '*';
add_header "Access-Control-Allow-Credentials" "true";
add_header "Access-Control-Allow-Methods" "*";
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
add_header "Access-Control-Expose-Headers" "*";
参考文档————————————————
版权声明:本文为CSDN博主「ENVON」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/envon123/article/details/83270277`
修改如下:
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,web-token,app-token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
任然报错
测似使用地址:
https://hls-js.netlify.app/demo/
https://developer-tools.jwplayer.com/stream-tester
安装 Google 跨越插件也不行
有人遇见没?Centos 系统
lystormenvoy commented
options里也要的