diff --git a/lib/models/OERMaterial.php b/lib/models/OERMaterial.php
index 668d8223e449234320ac9e159928e56ce5bec69a..c84d7b5ff790b0e1228a4c9519a8258b519103f6 100644
--- a/lib/models/OERMaterial.php
+++ b/lib/models/OERMaterial.php
@@ -387,7 +387,7 @@ class OERMaterial extends SimpleORMap
             return false;
         }
         $url = $this->getDownloadUrl();
-        $headers = get_headers($url, true);
+        $headers = get_headers($url, true, get_default_http_stream_context($url));
         if ($headers['Content-Disposition']
             && substr($headers['Content-Disposition'], 0, strlen('attachment')) === 'attachment') {
             //in this case the server forces to download the document and we cannot display it in an iframe: