前言

  • 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

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐