diff --git a/CrestApi/CrestApi.h b/CrestApi/CrestApi.h
index f1d797e23b09485074b7ba2dae1caf3350cced56..301ca8ab102393e158ff28c48f369dc79f72504f 100644
--- a/CrestApi/CrestApi.h
+++ b/CrestApi/CrestApi.h
@@ -77,6 +77,7 @@ namespace Crest
 
         std::string m_host;
         std::string m_port;
+        std::string m_prefix = "http://";
 
         Crest::CrestRequest m_request = Crest::CrestRequest();
 
diff --git a/CrestApi/CrestRequest.h b/CrestApi/CrestRequest.h
index 683b4d48382cfeb3c158c2335586442e0d5578a6..59b668d0666d3bbbca7fdacc3be93663ec17324c 100644
--- a/CrestApi/CrestRequest.h
+++ b/CrestApi/CrestRequest.h
@@ -70,6 +70,7 @@ namespace Crest
     {
 
     private:
+        std::string m_prefix = "http://";
         std::string m_host;
         std::string m_port;
         std::string make_url(const std::string &address) const;
@@ -96,6 +97,8 @@ namespace Crest
 
         void setHost(const std::string& host);
         void setPort(const std::string& port);
+        void setPrefix(const std::string& prefix);
+      
         /**
          * General auxiliary method to make request to the CREST Server. This method is used by other methods realizing the
          * requests with the concrete kinds of data (iovs|payloads|tags…).
diff --git a/src/CrestApi.cxx b/src/CrestApi.cxx
index cb7e58a0167bc5d9b22f43422035a11f328bd988..6eb681623ecb580fa5cd8a6f392519db29a276fb 100644
--- a/src/CrestApi.cxx
+++ b/src/CrestApi.cxx
@@ -39,6 +39,7 @@ namespace Crest
         }
         m_request.setHost(m_host);
         m_request.setPort(m_port);
+	m_request.setPrefix(m_prefix);
     }
 
     /**
@@ -61,31 +62,32 @@ namespace Crest
         size_t n = url.size();
 
         std::string_view url_new = url.substr(found + 3); // url_new is the url excluding the http part
+        m_prefix = url.substr(0,found + 3); // URL prefix "http://" or "https://"
+	
         size_t found1 = url_new.find_first_of(':');
         size_t found2 = url_new.find_first_of('/');
 
         std::string_view host;
         std::string_view port;
         std::string_view resources;
-        if (found1 != std::string::npos && found2 != std::string::npos)
-        {
-            host = url_new.substr(0, found1);
-            port = url_new.substr(found1 + 1, found2 - found1 - 1);
-        }
-        else if (found1 != std::string::npos)
-        {
-            host = url_new.substr(0, found1);
-            port = url_new.substr(found1 + 1);
-        }
-        else if (found2 != std::string::npos)
-        {
-            port = "80";
-            host = url_new.substr(0, found2);
-        }
-        else
-        {
-            port = "80";
-            host = url_new;
+        if (found1 != std::string::npos && found2 != std::string::npos) {
+          host = url_new.substr(0, found1);
+          port = url_new.substr(found1 + 1, found2 - found1 - 1);
+        } else if (found1 != std::string::npos) {
+          host = url_new.substr(0, found1);
+          port = url_new.substr(found1 + 1);
+        } else if (found2 != std::string::npos) {
+          if (m_prefix == "https://") {
+    	    port = "443";
+          }
+          else port = "80";
+          host = url_new.substr(0, found2);
+        } else {
+          if (m_prefix == "https://") {
+	      port = "443";
+          }
+          else port = "80";
+          host = url_new;
         }
 
         if (found2 < n - 1)
@@ -98,6 +100,7 @@ namespace Crest
         m_host = std::string(host);
         m_request.setHost(m_host);
         m_request.setPort(m_port);
+	m_request.setPrefix(m_prefix);
 
         if (check_version == true)
         {
@@ -271,7 +274,7 @@ namespace Crest
 
     std::string CrestClient::makeUrl(const std::string &address) const
     {
-        std::string str("http://");
+        std::string str = m_prefix;
         str += m_host;
         str += ':';
         str += m_port;
diff --git a/src/CrestApiFs.cxx b/src/CrestApiFs.cxx
index f28d01905aca7842ff829acdcc6dae0d75a51d06..e0146068800a8273ac359aa6836a2412e00ade9d 100644
--- a/src/CrestApiFs.cxx
+++ b/src/CrestApiFs.cxx
@@ -52,11 +52,11 @@ namespace Crest
 
   // UTILITIES Methods
 
-  std::string CrestFsClient::getFileString(const std::string &path)
-  {
+  std::string CrestFsClient::getFileString(const std::string& path) {
     std::ifstream ifs(path);
-    return std::string((std::istreambuf_iterator<char>(ifs)),
-                       (std::istreambuf_iterator<char>()));
+    std::stringstream buf;
+    buf << ifs.rdbuf();
+    return buf.str();
   }
 
   std::string CrestFsClient::buildPath(const std::string &path, const std::string &name)
diff --git a/src/CrestRequest.cxx b/src/CrestRequest.cxx
index cbd8bed22179bf0c4f31cb7194167e00454bca80..d306235415754e77987dd42932b247497afc91f4 100644
--- a/src/CrestRequest.cxx
+++ b/src/CrestRequest.cxx
@@ -38,9 +38,14 @@ namespace Crest
     m_port = port;
   }
 
+  void CrestRequest::setPrefix(const std::string &prefix)
+  {
+    m_prefix = prefix;
+  }
+  
   std::string CrestRequest::make_url(const std::string &address) const
   {
-    std::string str("http://");
+    std::string str = m_prefix;
     str += m_host;
     str += ':';
     str += m_port;