For the sake of clarity, I will try to describe my configuration as precisely as possible.
- Magento 2.3.5-p1
- NGINX + FPM - PHP 7.3
- Varnish -> Full page cache
- Redis -> Session Cache
- CDN -> CloudFront with Same distribution for each domain
- Theme -> Porto Child Theme for each domain
two domain names :
- domain1.com => Main domain through which I also access the administration
- domain2.com => Secondary domain created in a second step
These two domains point to the same server (type A redirection), and Nginx takes care of sending each domain to its website.
In the back office, two websites have been created, each with its own "Store" and "Store Views".
In store -> settings -> configuration -> General -> Web -> Base URL
In store -> settings -> configuration -> General -> Web -> Base URL (Secure)
The links have been well provided.
All redirections are working properly. When I access domain1.com or domain2.com, I have the right site appearing.
Now come the problem :
On domain1.com => NO PROBLEM.
On domain2.com => Path of images / CSS / JS, not working properly.
Instead of having :
I have :
Result : Don't working due to CSP restrictions. I could easily solve the problem by putting domain1.com on my white list.
But this is not a suitable solution for me. Indeed, I would like to say:
- That the right domain is used, namely domain2.com instead of domain1.com.
- Even better, let it go through the CDN like on domain1.com !
On the other hand, it should be noted that some files pass well on the CDN.
Really not knowing where to look for this problem, I turn to you to try to find a solution.
I thank you in advance for all your comments, help, and suggestions that can help me solve this problem.