Hello,
I was facing this issue on the subdomain site, were subdomain accessing the assets from parent site domain.abc from folder structure pattern path of image file.
Was getting 404 error for loading image… (why I am explaining all over this, lets come to point of fixing 🙂 )
To note I was doing this under my Cpanel Shared Hosting Server.
In my root folder (mdw) of assets for example mdw/assets/images/ created .htaccess files and added following lines of code:
SetEnvIf Origin "http(s)?://(.+\.)?mywebsite\.com(:\d{1,5})?$" CORS=$0
Header set Access-Control-Allow-Origin "%{CORS}e" env=CORS
Header merge Vary "Origin"
and the image started loading fine, CORS issue resolved.
Just in regex above replace with the exact domain name of parent it will fix the CORS issue of the question.
Beside, if you don’t have access to shared host or cpanel, then try to install browser CORS plugin and enable it to load the resources by bypassing this CORS issue, in same case it still won’t work you would need request your team or superior to get it resolved for you 🙂
Thanks for reading!
Happy Learning!