I have a web page using Twitter Bootstrap. It works well in Chrome, Firefox, and Safari. However, when I try to view it in Edge on Windows 10, I get a bunch of 403 errors saying it failed to load a slew of .less files from the Bootstrap CDN. Why are .less files being requested if the browser can't do anything with them? I am not using LESS at all, just plain CSS3, which is rendering just fine. How do I make this stop?
-
1Most likely they tried to add support for CSS sourcemaps but did not yet polish this feature. (Unless it does not actually try to request those files until you actually open its stylesheet debugger/inspector).– seven-phases-maxFeb 1, 2016 at 23:43
-
1P.S. Obviously by "they" I mean MS, not Bootstrap.– seven-phases-maxFeb 1, 2016 at 23:52
-
1Edge requests the files when the F12 tools are opened by the looks of things. Chrome doesn't make the request till the less file is navigated to. The Chrome tools also 403 however the don't appear to report the 403 on the network tab. You just get a blank .less file. The Edge behaviour is probably the one I'd prefer since with Chrome it's very easy to not realise you have an issue.– Martin BeebyFeb 2, 2016 at 10:41
2 Answers
The good news is this won't be affecting regular users of the site. The bad news is this is also happening in Chrome to some extent, it's just that the network tab in Chrome isn't reporting the 403 errors.
In the CSS file that you link to there is a line at the bottom of the file:
/*# sourceMappingURL=bootstrap.min.css.map */
This is the source maps and gives links to all the source files used to generate the minified CSS that is in your browser.
In the bootstrap instance the CDN is pointing to files that do not exist such as http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/less/scaffolding.less
The source map file will only be downloaded if you have source maps enabled and your dev tools open. Edge defaults source maps on and as far as I can tell there is no way to switch them off (but remember this will only happen when the dev tools are open, I have confirmed this behaviour using Fiddler), so when you press f12 then it's going to try and fetch the source mapped files. Chrome works slightly differently, it will download the source map but then will not attempt to download the .less file until you navigate to the source file.
If one of the .less files is returning a 403 Forbidden response Edge reports this in the network tab. Chrome dosen't.
If you use http debugger such as Fiddler you will see that Chrome does indeed request the files and also gets a 403 response, however, it doesn't report it on the network tab. When using Fiddler to get past the https issue I changed the CSS file to point to the non https URL. e.g: http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
The fix for this issue is to fix the files that are 403'ing in the source map. I have raised an issue on the bootstrap maxcdn GitHub repro: https://github.com/MaxCDN/bootstrap-cdn/issues/629
-
1
-
A quick fix might be (on the live version of the site) to rename the file 'bootstrap.min.css.map' (eg 'disabled-bootstrap.min.css.map') and place an empty file called 'bootstrap.min.css.map' in the same folder. That seems to be a quick and dirty fix in my case. Aug 31, 2017 at 9:46
There is a known issue with MaxCDN itself. (and CDNjs as well)
Logged issues for reference:
https://github.com/MaxCDN/bootstrap-cdn/issues/671 - This issue is closed as duplicate
https://github.com/MaxCDN/bootstrap-cdn/issues/629 - known bug
https://github.com/twbs/bootstrap/issues/19063 - open issue with Twitter bootstrap
CDN analysis:
For sourceMappingURL
which is bootstrap.min.css.map
for bootstrap file, any of the .less
extension files (e.g. this file) are failing to load with HTTP status 403
(forbidden).
Chrome is supressing this issue in the developer console, however Edge is not. The issue when accessing the .less files is reproduceable by accessing this link.
This issue is not only with MaxCDN, but also with CDNjs. The links for CDNjs are this,this & this