I have an Appache Server (2.4) running on my machine, and would like to enable CORS for a certain file.
According to this source I need to do something like the following i my httpd.conf:
<Files "C:/xampp/htdocs/some/path/file.txt">
Header set Access-Control-Allow-Origin "*"
</Files>
I have added this to my httpd.conf file, saved it, and restarted the server.
However, when trying to get this resource via ajax from a different network, I still get this issue:
XMLHttpRequest cannot load http://SERVERDNS.com/some/path/file.txt. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
How can I fix this? I am not sure if I put the tag in the correct place in httpd.conf, and also I am not sure about whether the Setting itself is done correctly.
I am running this server on a Windows Server 2012 machine on the Amazon Web Services EC2 cloud.
Can anyone shed some light onto this for me?
Thanks, best regards,
Chris