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?
Access resources of secondary server running different port apache2
apache2;http headers;configuration
this is how to fix this:sudo nano /etc/apache2/apache2.confPut in this code at the bottom:.<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: Range</IfModule>Enable headers in config file: sudo a2enmod headersCheck for errors do: sudo apachectl -k gracefulsudo service apache2 reloadsudo service apache2 restartDone