I'm using magento 2.4.5 nginx with varnish i want to use cdn and has set config to below section :
Secure Base URL for User Media Files: https://subdomain.mysite.com/pub/media/
Secure Base URL for Static View Files : https://subdomain.mysite.com/static/
Every pages works well just checkout page and admin section shows below errors:
Access to XMLHttpRequest at 'https://subdomain.mystie.com/static/version1670233149/adminhtml/mystie/admintheme/en_US/Magento_Ui/templates/modal/modal-popup.html' from origin 'https://mystie.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I tried some solution like :
add to location /
in nginx.config.sample below code:
add_header 'Access-Control-Allow-Origin' '*' ;
but errors not cleared .
Please help and best solution !