SSL errors on Heroku (Mixed contents) I have an app via Drupal 7 on Heroku. You know, myapp.herokuapp.com is default with SSL. 

But when I try https://myapp.herokuapp.com get many errors in console like this:

 Mixed Content: The page at 'https://myapp.herokuapp.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://myapp.herokuapp.com/modules/system/system.base.css?ngonpd'. This request has been blocked; the content must be served over HTTPS.


I tried to add this code in settings.php but not working:

if (isset($_SERVER['HTTPS']) &amp;&amp; strtolower($_SERVER['HTTPS']) == 'on') {
  $base_url = 'https://myapp.herokuapp.com';
}
else {
  $base_url = 'http://myapp.herokuapp.com';
}


How can I fix this?
IMO $base_url in settings.php should work 

Alternatively you can try 

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]


or

RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]