Scenario: my client has a tight server environment where the server cannot communicate to the internet except to serve pages on port 443 and port 80. (so there's nothing in the server dns cache and port 53 out is blocked)
In this case, CDNs only work for the client, not for the server.
This bug occurs after 3.17 , so 3.18 and higher.
Workaround/Solution:
Add this patch which adds the missing drupal-bootstrap.min.css and also a missing less file that is otherwise provided by server side cdn which doesn't work for servers that cannot access the internet other than serving 443 and 80.
This particular client is using IIS on Windows.
The patch does the job, see the patch.
Comments
Comment #2
joseph.olstadComment #3
joseph.olstadissue started in stackoverflow
https://stackoverflow.com/questions/60170467/drupal-8-warning-illegal-st...
Comment #4
markhalliwellThis seems like a backwards solution (and honestly complete overkill) to the actual error you've encountered:
Also, this project has never and will never commit 3rd party (i.e. upstream Bootstrap CSS) to its codebase.
Comment #5
markhalliwellA simple
empty($file['name']) ||prepended to the if statement would likely suffice.https://git.drupalcode.org/project/bootstrap/blob/8.x-4.x/src/Plugin/Pro...
Comment #6
joseph.olstad@markcarver, my clients servers port 53 out is blocked, so dns is not working , so the server side cannot get any cdn content
PS, it was really tough figuring this out because the TTL values in the ProviderInterface.php are very high, so somewhere these values are cached and a simple cache rebuild will not flush them out. I even deleted the tmp directory and tried to find the files in sites/default/files/? not sure where these values get cached didn't have time to look close enough at the code, so in a code blitz to power through, I set all the TTL values to 0 in the ProviderInterface.php in order to have that part of the code execute where it's trying to go out to the cdn.
Due to supporting servers that have no port 53, I would much prefer that this cdn logic was moved to the front-end so that the requests to the cdns is all done on the front end and not from the back end.
Comment #7
joseph.olstadthe undefined index issue is merely a symptom of a server that doesn't have access to request dns resolution of cdn names
The other reported issues were on IIS servers, this might affect other environments if you flush all the cached values set TTL to 0 and kill port 53 out on the server asuming also the said server is not also a dns server with cached dns values.
also to test would have to maybe flush dns cache on the server after blocking port 53 out.
Comment #8
joseph.olstadComment #9
markhalliwellhttps://drupal-bootstrap.org/api/bootstrap/docs!Theme-Settings.md/group/...
Just set the following in your sub-theme then:
cdn_provider: ''Then manually inject the link and script tags in your sub-theme's html.html.twig file that point to the specified CDN URLs you want.
No need in attempting to use the CDN provider system if your server can't even access it.
Comment #10
joseph.olstadok thanks for the tip, however we will still need a patch to fix the undefined index no?
or does setting cdn to '' in the sub theme get rid of any requests on the server end?
maybe a checkbox setting for bootstrap to turn on or off this.?
Comment #11
joseph.olstadanyhow thanks for your tips, I'll see if I can come up with a helpful patch.
Comment #12
markhalliwellNo. As you stated, this is really just a symptom of a very specific nature. I think it would rather make more sense to keep this error so it's searchable and people can come to this issue and see what's going on.
In reality, it should have never gotten that far (still not sure how it did) because it would mean that that URL returned had a valid "files" property inside a JSON object that was successfully decoded.
There's already a select option in the dedicated "CDN (Content Delivery Network)" theme settings tab, where you can simply set the CDN Provider to "None".
Comment #13
joseph.olstadok sounds good, thanks for your assistance and great work on this.
Comment #14
joseph.olstad*** EDIT ***
I will test the option 'none' see what happens.
Comment #15
joseph.olstadWhen I choose the option 'none' (compile locally) , it sounds like I have to compile something
from the docs:
I'm guessing, but it seems like to get the compiled resources I would have to choose the options from this webform from:
https://getbootstrap.com/docs/3.4/customize/
then download and copy them to the css folder
such as vendor-prefixes.less and bootstrap.min.css?
in order to test this I guess I'd have to disconnect my dev servers from the internet as are my clients servers or have a local copy running disconnected from the web.
Comment #16
joseph.olstadHere is patch 2 rerolled for HEAD of 8.x-3.x
Patch 2 is for bootstrap 8.x-3.21
patch 16 is for bootstrap 8.x-3.23
This is an edge case for servers that have no CDN access, crash otherwise.
IMHO, it should only be the client that uses CDN, not the server.
Comment #17
jonathanvarunbenjamin commentedhow do we install the patches?
Comment #18
joseph.olstad@jonathanvarunbenjamin
have a look at your composer.json file for your project in the root of your drupal project and add a line for drupal/bootstrap something similar to this example:
once you have done this run composer install
assumes you have composer installed correctly.
https://www.youtube.com/watch?v=PF8eDim7Wts
Comment #19
Holka_a commentedMy bad refer below patch
Comment #20
Holka_a commentedPatch for D10 compatible version of bootstrap.