I'm currently running a main server from a raspberry pi (32 GB) and a secondary server (4 TB) running as the file storage server. Both servers are running Debian Linux with Apache2 installed. I've been successful to bring PHP output from secondary server to main server with this code:
Main server:
<?php
$results = file_get_contents('http://example.org:700/handle.php');
echo $results;
?>
Secondary Server
<?php
header('Access-Control-Allow-Origin: http://example.org');
//Rest of code
?>
So I came to the problem where the main server would be able to show pictures and play mp3/wav from the secondary server, but in my case, it wouldn't work with FLAC (with a bit of javascript code). Here is some useful info from apache2.conf:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin: "http://example.org"
Header set Access-Control-Allow-Credentials: true
Header set Access-Control-Expose-Headers: "Content-Length"
Header set Access-Control-Allow-Methods: "POST, GET, PUT, OPTIONS, DELETE, HEAD"
Header set Access-Control-Allow-Headers: "Content-Length"
</IfModule>
Right now I get this error from google chrome:
XMLHttpRequest cannot load http://example.org:700/song.flac. Request header field Range is not allowed by Access-Control-Allow-Headers in preflight response.
I simply want to allow all traffic between the two servers to be secure and with no XMLHttpRequest errors. Is there something I can change in the config file to make this work?
Header set Access-Control-Allow-Headers "Range"
and then restart your server. If that doesn't work, then flag this to request migration.