Skip to content Skip to sidebar Skip to footer

CORS Headers For Accessing A File On Another Domain

I am attempting to create an audio visualization program on Codepen. I have created my own Ubuntu web server with apache which allows me direct access to modify headers and configu

Solution 1:

My first thought is that the problem is your

Access-Control-Allow-Origin: *, *

I don't think it is understanding the *, * thing. Try just *.

Edit: you can check what the header really looks like with a command like this:

curl -v -o /dev/null http://williamgreen.hopto.org/audioVisualization/song.mp3

And, lo, it even works for me, yielding (among a lot of other headers):

< Access-Control-Allow-Origin: *

So that is hunky-dory.

Second, are you running this from a file: origin? That doesn't work on Chrome (I thought it would work on Firefox, but maybe that's changed). You have to run it from an http: or https: origin.

By "running from an file: origin" I mean, is the HTML file that is running that Javascript being loaded from an URL that beings with "file:". If so, that is not likely to work.


Post a Comment for "CORS Headers For Accessing A File On Another Domain"