Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request header field Range is not allowed by Access-Control-Allow-Headers

Tags:

apache

header

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

like image 856
Guhh Avatar asked Feb 29 '16 18:02

Guhh


People also ask

What is Access-Control allow headers?

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.

How do you add a header in Access-Control allow origin?

Simply add a header to your HttpServletResponse by calling addHeader : response. addHeader("Access-Control-Allow-Origin", "*");

How do you fix CORS missing 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.


1 Answers

I just added

Header set Access-Control-Allow-Headers "Range"
like image 151
Guhh Avatar answered Nov 14 '22 23:11

Guhh