I have been trying to get my magento store working with AWS CloudFront for static and media folders. I have one CloudFront distribution for each of the folders. Media files are working fine as well as most of the static files.
The only things that is failing is html and fonts - I get a CORS error. I have been trying to figure out the issue, but have no idea how to proceed. I have validated the CORS headers - they seem to be ok.
My .htaccess in pub/static/ below:
<IfModule mod_headers.c> <FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|html|json|swf|eot|ttf|otf|woff|woff2)$> Header set Cache-Control "max-age=604800, public" Header set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" Header set Access-Control-Max-Age "604800" Header set Access-Control-Allow-Headers "Host, Content-Type, Origin, Accept" </FilesMatch> <FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$> Header append Cache-Control no-store </FilesMatch> </IfModule>
Anyone has any idea where should I start investigating or what might be the problem?
The below works for CSS files and all others. HTML matches the same rule, so I am not sure why only HTML files are showing this error.
I have used this link as a guide: mageplaza.com/kb/setup-amazon-cloudfront-cdn-in-magento-2.html They mention something about the HTML files not working properly, but they do not explain what do they mean behind that...