请求标头字段范围不被Access-Control-Allow-Headers所允许 [英] Request header field Range is not allowed by Access-Control-Allow-Headers

查看:3560
本文介绍了请求标头字段范围不被Access-Control-Allow-Headers所允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  XMLHttpRequest不能使用HLS JS来获取我的视频加载http://domain.com/video.ts。请求标头字段范围不适用于预检响应中的Access-Control-Allow-Headers。 

我使用Apache配置:

 标题集Access-Control-Allow-Origin*
标题集Access-Control-Allow-Methods选项,头,GET,POST,PUT,DELETE
标题集Access-Control-Allow-HeadersOrigin,X-Requested-With,Content-Type,Accept,Key,Content-Length,Authorization


AddType video / webm .webm
AddType video / mp4 .mp4
AddType video / ogg .ogv
AddType application / x-mpegurl .m3u8

#hls transport stream segments:
AddType video / mp2t .ts
#字幕文字轨道:
AddType文字/ vtt .vtt

一个Google搜索一下,我想知道我应该删除/添加什么标题?

谢谢


 标题集Access-Control-允许标题范e


I'm trying to get my video with a HLS JS and I'm getting the follow error:

XMLHttpRequest cannot load http://domain.com/video.ts. Request header field Range is not allowed by Access-Control-Allow-Headers in preflight response.

I'm using the Apache configuration:

Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "OPTIONS, HEAD, GET, POST, PUT, DELETE"
    Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Key, Content-Length, Authorization"


    AddType video/webm            .webm
    AddType video/mp4             .mp4
    AddType video/ogg             .ogv
    AddType application/x-mpegurl .m3u8

    # hls transport stream segments:
    AddType video/mp2t            .ts
    # subtitle text tracks:
    AddType text/vtt              .vtt

A googled a little and i would like to know what headers I should remove/add?

Thank you

解决方案

I just added

Header set Access-Control-Allow-Headers "Range"

这篇关于请求标头字段范围不被Access-Control-Allow-Headers所允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆