cancel
Showing results for 
Search instead for 
Did you mean: 

Problem to install Magento 2.4.1 on xampp - violates Content Security Policy

SOLVED

Problem to install Magento 2.4.1 on xampp - violates Content Security Policy

I followed this instructions "How to install Magento 2.4 on Localhost (Xampp) with Elasticsearch" to install Magento 2.4.1 on XAMPP 7.4.13.

 

I have installed XAMPP, composer, elasticsearch successfully.

The differencies were only:

1. I have set xampp to use post 8080.
2. I have used 127.0.0.1 instead of localhost in php setup:install (but tried it with localhost as well - same errors) 

php bin/magento setup:install --base-url="http://127.0.0.1/luma/" .....

Successfully did indexer:reindex, setup:upgrade, setup:static-content:deploy -f, cache:clean, cache:flush

But when I try to access home page I get errors (in console of inspector in Chrome) as following and I cannot access admin page as well (404).

[Report Only] Refused to load the stylesheet '<URL>' because it violates the following Content Security Policy directive: "style-src getfirebug.com cdn.dnky.co webchat.dotdigital.com yotpo.com <URL> p.yotpo.com staticw2.yotpo.com w2.yotpo.com 'self' 'unsafe-inline'". Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback.

screenshot: here

I suppose it is something stupid I have missed, but i am not able to find any solution or idea where to move.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Problem to install Magento 2.4.1 on xampp - violates Content Security Policy

The problem was in redirection of xampp port from 80 to 8080, and my inability to properly configure magento/.htaccess to respect this change.

 

I found a solution in stopping services using port 80 on Windows 10 by cmd command

 

net stop was /y

and disambling World Wide Web Publishing Service in services.

 

Then I could set the XAMPP back to port 80, and all works as expected.

More info : How to Solve Port 80 Problems When Running Apache on Windows

 

View solution in original post

1 REPLY 1

Re: Problem to install Magento 2.4.1 on xampp - violates Content Security Policy

The problem was in redirection of xampp port from 80 to 8080, and my inability to properly configure magento/.htaccess to respect this change.

 

I found a solution in stopping services using port 80 on Windows 10 by cmd command

 

net stop was /y

and disambling World Wide Web Publishing Service in services.

 

Then I could set the XAMPP back to port 80, and all works as expected.

More info : How to Solve Port 80 Problems When Running Apache on Windows