URL Replacement in CSS file is not relative, breaks https
-
I’m using Cloudfront CDN, along with minifying my css files.
The bootstrap css file contains URL’s to font files. These URL’s are replaced with the CDN URL, but hardcodes the scheme (http). This causes issues when I hit the site via https.
Another user suggested that you modify the ‘Theme file types to upload:’ field, and remove the font file types. This would then ignore the font file URL’s, leaving the relative URL’s in place, and allow it to work with http and https.
https://ww.wp.xz.cn/support/topic/minify-css-fonts-not-requested-over-ssl/#post-9494279
This does not seem to work for me using Cloudfront PULL, as these files are never uploaded by W3TC, Cloudfront, pulls them, and I assume W3TC is ignoring this field, when replacing URLs.
I tried using the Reject files options, but could not get that to work. My minified and combined css files, still have the CDN URL as http:// scheme. I would like it to not touch this URL, so that the scheme would be relative. Because the boostrap.min.css file is loaded from the CDN, then the fonts files would also be loaded from there as well.
Specificially this is happening in bootstrap.min.css which has
@font-face{font-family:’Glyphicons Halflings’;src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format(’embedded-opentype’),url(../fonts/glyphicons-halflings-regular.woff2) format(‘woff2′), etc
gets replaced with
@font-face{font-family:’Glyphicons Halflings’;src:url(http://cdn5XXXX/sgmwp/wp-content/themes/se-2016/js/bootstrap/fonts/glyphicons-halflings-regular.eot);src:url(http://cdn5XXXX/sgmwp/wp-content/themes/se-2016/js/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix) format(’embedded-opentype’),url(http://cdn5XXXX/sgmwp/wp-content/themes/se-2016/js/bootstrap/fonts/glyphicons-halflings-regular.woff2) format(‘woff2’),url(http://cdn5XXXX/sgmwp/wp-content/themes/se-2016/js/bootstrap/fonts/glyphicons-halflings-regular.woff) format(‘woff’),url(http://cdn5XXXX/sgmwp/wp-content/themes/se-2016/js/bootstrap/fonts/glyphicons-halflings-regular.ttf) format(‘truetype’),url(http://cdn5XXXX/sgmwp/wp-content/themes/se-2016/js/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format(‘svg’)}.glyphicon{position:relative;top:1px;display:inline-block;font-family:’Glyphicons Halflings’;
Does anyone know how to do this?
Thanks,
Rich
The topic ‘URL Replacement in CSS file is not relative, breaks https’ is closed to new replies.