CDN (CloudFront) and WebFonts
-
Ok guys, hoping someone can help I’ve tried everything available online to no avail!
I’m using Siteground to host my website, using W3TC alongside an Amazon Cloudfront CDN.
All images, CSS, JS etc etc load perfectly from the CDN.
Webfonts however… I’m getting the dreaded:
“Access to font at ‘https://cdn.tpet.co.uk/wp-content/plugins/mobile-menu/includes/css/font/mobmenu.woff2?31192480’ from origin ‘https://tpet.co.uk’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”
Error for all my web fonts.
What I have tried…
– Setting a CORS policy on the S3 bucket
– Adding the ‘origin’ header to the CDN distribution behaviour
– Setting the CDN behaviour to ‘HTTPS’ only.
– Various other tweaks on the CDN side of things.– Editing the .htaccess to – Header set Access-Control-Allow-Origin “*” – for all appropriate files.
– I’ve tried many, many different .htaccess edits from around the web including targeting just the CORS envAs a last ditch effort to at least use the CDN for JS, IMGS, HTML etc I’ve tried to STOP the CDN from getting the font files from the CDN but it seems that no matter what I try the font locations are always written into the minified CSS files as CDN links.
Here are my CDN settings in W3TC – at the time of writing, webfonts are still being requested from the CDN and causing errors, even though the CSS is now being loaded locally…
OFF - Only Purge Manually OFF - Disable for SSL OFF - Use CDN links for ML ON - Add CORS header (have also tried switching this off, didnt work) OFF - Disable for roles WP-includes files to upload: *.css;*.js;*.gif;*.png;*.jpg;*.xml Theme files: *.js;*.gif;*.png;*.jpg;*.ico;*.less File types to import: (empty) Custom File List: favicon.ico {wp_content_dir}/gallery/* {wp_content_dir}/uploads/tpet-uploads/* {wp_content_dir}/uploads/avatars/* {plugins_dir}/wordpress-seo/css/xml-sitemap.xsl {plugins_dir}/wp-minify/min* {plugins_dir}/*.js {plugins_dir}/*.gif {plugins_dir}/*.jpg {plugins_dir}/*.png User agents (empty) Rejected files: {uploads_dir}/wpcf7_captcha/* {uploads_dir}/imagerotator.swf {plugins_dir}/wp-fb-autoconnect/facebook-platform/channel.html {plugins_dir}/onesignal-free-web-push-notifications/sdk_files/manifest.json.php {uploads_dir}/fbrfg/* {plugins_dir}/*.css {wp_content_dir}/cache/minify/*.css {plugins_dir}/mobile-menu/includes/css/font/* {plugins_dir}/*.ttf {plugins_dir}/*.otf {plugins_dir}/*.woff {plugins_dir}/*.woff2
I’ve tried lots of other tweaks too, I’ve spent days trying to solve this using various blogs (including amazons own help post on this subject) to no avail.
Please can someone help?
At this point i’d settle for the fonts just to be loaded locally, i’d prefer everything to come from the CDN but I just want a working website!
- The topic ‘CDN (CloudFront) and WebFonts’ is closed to new replies.