You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Fortmüller <ch...@gmail.com> on 2014/09/21 01:14:02 UTC
[users@httpd] Cross-Origin-Resource-Sharing with Apache for a single file doesnt
work, why?
Hi, I am new to this mailiing list. I am looking for help regarding a CORS
issue with my Apache Server:
I have an Appache Server (2.4) running on my machine, and would like to
enable CORS for a certain file.
According to this
<http://jerome.co.za/enabling-cross-origin-resource-sharing-aka-cors-in-apache/>
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
<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