How to setup Access_Control_Allow_origin & From origin blocked by CORS in Nginx for Mageno 2 multi-Website store?

My main website store URL:

Second website store URL :

Initially, i developed multi-website in the localhost, and its working also but after move to live server main website working but second website store not working.

enter image description here


SetEnvIf Host* MAGE_RUN_CODE=grocery
SetEnvIf Host* MAGE_RUN_TYPE=website

Note : Followed this tutorial still facing issues.

Magento Asked on November 20, 2021

3 Answers

3 Answers

You need to set up CSP in your website. Check this Magento CSP doc

Create csp_whitelist.xml in your module loading the second website inside etc folder

<?xml version="1.0"?>
<csp_whitelist xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
        <policy id="font-src">
                <value id="your-test-website" type="host"></value>

Answered by Afreen Sheikh on November 20, 2021

set the cross-origin in app/etc/env.php by changing the following parameter.

'x-frame-options' => 'CROSS-ORIGIN',

after changing flush your magento cache

php bin/magento c:f

enter image description here

Answered by Sanaullah Ahmad on November 20, 2021

Go to Content->Design->configurations

Click on edit link against your website.

apply a different them for each website. enter image description here

now run these commands.

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

php bin/magento c:f

Answered by Sanaullah Ahmad on November 20, 2021

Add your own answers!

Related Questions

MAC OS Magento 2.4.1. PWA Studio 8.0.0 Local Setup Steps and Bugfix

0  Asked on December 19, 2020 by rishimukesh


Overriding Helper

2  Asked on December 19, 2020 by myron


Magento emails are not going

1  Asked on December 18, 2020 by user00247


Problem with payment,

1  Asked on December 16, 2020 by mariam-todadze


Special Price Not Applying in Magento2 Cart

2  Asked on December 14, 2020 by dinesh


Get matrixrate config programatically

0  Asked on December 14, 2020 by pevik


Error 404 : The requested page do not exist

1  Asked on December 14, 2020 by claims


Magento 2 Checkout shipping afterRender

0  Asked on December 13, 2020 by mac_mod


How to make checkout page 2columns-left on magento 2

1  Asked on December 13, 2020 by alin-lupoiu


magento2 plugin and str_replace

2  Asked on December 11, 2020 by boll


Custom email layout handle for custom module

2  Asked on December 11, 2020 by karan-adhikari


Magento 2 – Remove debug path hint from email template

3  Asked on December 9, 2020 by hardik


Watermark magento 2

2  Asked on December 9, 2020 by pascal-van-kooten


Ask a Question

Get help from others!

© 2021 All rights reserved.