问题
Even though I've added this in my .htaccess file:
Header add Access-Control-Allow-Origin "*"
And this in my apache config: (Inside a section AND outside)
<Files ~ "\.(gif|jpe?g|png|js|json|xml)$">
Header set Access-Control-Allow-Origin "*"
</Files>
It still does not work!
When I get the DIRECTORY it does give me the wanted header, but as soon as I download a specific file the header is nowhere to be found!
How hard can it be?
回答1:
try
<FilesMatch "\.(gif|jpe?g|png|js|json|xml)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
来源:https://stackoverflow.com/questions/6329655/access-control-allow-origin-headers-not-working