I'm moving my Drupal 7 website to https but I keep having issues with some images that gets loaded with full path, but with http://. For example the site logo and view images have http:// path. (Inside DB table file_amanged files are all saved with public:// path.) They are all files loaded through the Drupal UI.

How can I force all images to use https?


I know this is an old post but I ran into this issue on several sites with a ton of content. I ended up adding a meta tag to my html.tpl for a quick fix

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

See https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content

|improve this answer|||||

You need to use a module like Pathologic which will force protocol relative URLs for all assets.


The public:// path is a stream wrapper, and has no effect on whether the browser sees http/https or not. Pathologic will fix all of this for you.

|improve this answer|||||
  • I've already installed pathologic and tried both 1. Protocol relative URL (//example.com/foo/bar) 2. Path relative to server root (/foo/bar) but none of them solved my issue. – Mbertin Sep 22 '17 at 13:22

The only solution I've found so far is adding a mytheme_preprocess_html to replace all absolute:

Insecure content warning with D7 and SSL

|improve this answer|||||
  • Sounds like you may have some absolute URLs in your DB. A preprocess function can certainly sort that out if you don't want to fix and find them in the DB. – Alfred Armstrong Sep 25 '17 at 9:01
  • I've checked on file_managed table but there is no absolute URL there. I've cleared cache hundreds of times and still I got http instead https. I don't where else to look. – Mbertin Sep 25 '17 at 14:50
  • The only http content I can see is your favicon, which will be set via the variables table most likely. – Alfred Armstrong Sep 25 '17 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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