1

I have install magento 2.4.3. But i have getting this error in console.

Access to font at 'http://localhost/m243/pub/static/version1628682058/adminhtml/Magento/backend/en_US/fonts/opensans/regular/opensans-400.woff2' from origin 'http://127.0.0.1' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

How to solve this issue ?

enter image description here

2 Answers 2

1

You can add a billow line in .htaccess file

<IfModule mod_headers.c>    
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "*"
</IfModule>
0

I think you have an issue with the CORS policy, so you need to make the following changes:

  • Run this command in your terminal:

    Sudo a2emod headers

  • To add the CORS authorization to the header using Apache, simply add the following line inside either the <Directory>, <Location>, <Files> or <VirtualHost> sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file:

<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
  • Then simply restart the apache server:

apache2 -t

systemctl restart apache2.service

For more info: https://enable-cors.org/server_apache.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.