Home .htaccess ACCESS-Control-Allow-Origin is not added to the response header

ACCESS-Control-Allow-Origin is not added to the response header

Author

Date

Category

I get an error when you try to access the fonts on the server from the local machine.

font from origin ‘httr: //#######.##’ Has Been Blocked from Loading by Cross-Origin Resource Sharing Policy: No ‘Access-Control-Allow-Origin’ Header Is Present on the Requested Resource. Origin ‘Httr: // Localhost: 8080’ Is Therafore Not Allowed Access.

in .htaccess added:

& lt; ifmodule mod_headers.c & gt;
 & lt; filesmatch "\. (TTF | OTF | WOFF | WOFF2) $" & gt;
  HEADER SET ACCESS-CONTROL-ALLOW-ORIGIN "*"
 & lt; / filesmatch & gt;
& lt; / iFModule & gt;

It did not solve the problem. In the title, Access-Control-Allow-Origin: * 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 may be the problem?

Added 1

The problem of adding to the ACCESS-Control-Allow-Origin: * header, decided to turn on the mod_headers module. But the error still remains.

Current response heading:

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: *

Answer 1, Authority 100%

Check if you are on MOD_HEADERS.

Next add to .htaccess:

Header add access-control-allow-origin "*"

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions