Is there any way to force https:// to be used for assets and still be able to define a theme CSS files in its .info file?

Solutions

You might need to set the base URL in the settings.php file, specifying the URL scheme.

$base_url = 'https://my.domain.name';

For a Drupal 7 site using Cloudflare CDN and a Bootstrap theme, this worked for me: Set the base URL in your settings.php file, without including http:// or https://.

$base_url = '//my.domain.name';

For another Drupal 7 site with a different theme, just removing $base_url worked. In both cases, I needed the site to work with secure URLs and without.

One option is to use AdvAgg as this will generate different aggregate filenames for http and https. If the issue is the cache then advagg will not fix it though.

Tags: Ssl / .info

Similar questions

Attach JavaScript and CSS assets when render entity using Web Sockets
Goal: Attach all the necessary JavaScript and CSS files to the page, when a rendered entity is delivered on a Web Socket event. Given: Problem: JavaScript and CSS files, needed for rendering, are not attached on the page. (E.g. scripts for display of an image gallery, lazy-loading of images). My ideas: I think that I should list all the necessary J...
How to load absolute CSS and JS assets
I would like to load CSS and JS from https://static.example.com . The typical page contains: and contains similar entries for JS. I would like to add https://static.example.com to the front of the href="URL" for both CSS and JS. I'm am aware that this can be done with a contrib module. I would like to find a hook or some other way to add this to my...
Is there any reason Backup & Migrate leaves all the .info files around?
I just discovered that there are hundreds of .info files left lying around in the folder that the Backup & Migrate module uses for scheduled backups, while only 12 of these have a corresponding .gz file. Is there a reason to keep these? Do they have any real value?
HTTPS and SecurePages Infinite Redirect - How do I reset which pages are always HTTPS?
Using Secure Pages, I checked the option to have the site always be using HTTPS when logged in as an administrator, but now I have an infinite redirection issue, and I cannot log-in and navigate the site, leaving me to edit the settings manually. How do I "uncheck", or revert the option that I selected manually in SecurePages?
Why aren't CSS files served? There is nothing in sites/default/files/css
In my Drupal 8 installation profile, I install a theme and a lot of configuration for it. I'm using Features to install blocks/settings/views for it, but when I enable the feature Drupal stops serving ANY CSS files on page loads. I don't think it's an issue with features, because if I wait long enough, those files will be generated by Drupal and CS...
Getting .info file not found in my custom module, even though it does contain an .info file
I am trying to install my custom module, but the error I get is: modulename.tar.gz does not contain any .info files. My module tar.gz file does indeed contain a .info file. I have installed other modules on the server, so I shouldn't have any permission issues. The following is the content of the .info file.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.