I'm trying to get my video with a HLS JS and I'm getting the follow error:
XMLHttpRequest cannot load http://example.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
I googled a little and i would like to know what headers I should remove/add?
Thank you
The Access-Control-Allow-Headers response header is used in response to a preflight request which includes the Access-Control-Request-Headers to indicate which HTTP headers can be used during the actual request. This header is required if the request has an Access-Control-Request-Headers header.
Simply add a header to your HttpServletResponse by calling addHeader : response. addHeader("Access-Control-Allow-Origin", "*");
If the server is under your control, add the origin of the requesting site to the set of domains permitted access by adding it to the Access-Control-Allow-Origin header's value. You can also configure a site to allow any site to access it by using the * wildcard. You should only use this for public APIs.
I just added
Header set Access-Control-Allow-Headers "Range"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With