4

I have a theme which defines its CSS files in its .info file, for example with a line like the following.

stylesheets[all][] = css/style.min.css

The site is accessed using https://, but for some reason, Drupal tries to load all the files via http://.

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

3
  • Is it pure SSL? Or SSL/Non-SSL mix mode? Do you use securepages module?
    – Beebee
    Jul 24, 2013 at 14:37
  • That could be a caching issue where a client requesting a page over HTTPS gets a cached copy that was generated over HTTP and thus has HTTP links in it. I'm afraid I can't recommend an exact solution because it depends on the caching engine being used.
    – jamix
    Apr 30, 2014 at 14:40
  • The standard Drupal page cache is keyed on the full url, i.e. the http and https versions of the page are different, so this wouldn't normally be an issue. If this is the issue, then it's likely because you have something in front of drupal that converts the https to http. If that's the case, they you'll want to be consistent about anonymous page access to your site, i.e. force all urls to be http or https.
    – Alan Dixon
    Aug 31, 2015 at 13:53

3 Answers 3

4

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.

2

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

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.