前言

  • nginx 1.15.8.1

no-referrer-when-downgrade

在这里插入图片描述

解决办法

在nginx中(nginx.conf)添加允许跨域的配置:

server{
	listen 80 ;
	server_name localhost ;

	root /www/admin/localhost_80/wwwroot/ ;
	
	location / {
		index index.html;
	}
	
	...
	
    # 流媒体
    location ^~ /stream/hls1/ {
        # 跨域问题的配置
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Allow_Credentials' 'true' always;
        add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always;
        add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH' always;
        
        types{
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }
        alias /data/stream/hls1/;
        expires -1;
    }
}
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐