Access-Control-Allow-Origin is not added to the response header
I get an error when I try to access fonts on the server from a local machine.
Font from origin ' https://#######.##' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https:/ / localhost: 8080' is therefore not allowed access.
In .htaccess added:
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|otf|woff|woff2)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
That didn't solve the problem. In the header, Access-Control-Allow-Origin: * does not added.
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 23 Apr 2016 10:43:01 GMT
Content-Length: 142072
Connection: keep-alive
Last-Modified: Sat, 23 Apr 2016 09:11:31 GMT
ETag: "1856f6-22af8-53123544a33d2"
Accept-Ranges: bytes
What else could be the problem?
Added 1
The problem of adding Access-Control-Allow-Origin: * to the header was solved by enabling the module mod_headers. But the error still remained.
Current response title:
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 23 Apr 2016 11:19:03 GMT
Content-Length: 142072
Connection: keep-alive
Last-Modified: Sat, 23 Apr 2016 09:11:31 GMT
ETag: "1856f6-22af8-53123544a33d2"
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
0
1 answers
Check if you have the mod_headers module enabled.
Next, add in .htaccess:
Header add Access-Control-Allow-Origin "*"
1
Author: Urmuz Tagizade, 2016-04-23 11:21:25