I am pulling a json file from my project and then writing it as a static file in a javascript directory like so:
json_file_path = Rails.root.join("data", "infographics.json")
json_object = JSON.parse(open("http://url/api/infographics/all").read)
File.open(json_file_path, 'w') {|f| f.write(json_object.to_json) }
But when I go to read this file from my dev machine to the remote server I get an error of:
Origin http://0.0.0.0:3000 is not allowed by Access-Control-Allow-Origin.
Is this an apache setting or am I not setting my header correctly when I write it?
You could set the
Access-Control-Allow-Originheader like this:Header set Access-Control-Allow-Origin *in
<Directory>,<Location>,<Files>,<VirtualHost>or.htaccess