diff --git a/cdn.admin.inc b/cdn.admin.inc
index c424457..29a3271 100644
--- a/cdn.admin.inc
+++ b/cdn.admin.inc
@@ -245,6 +245,44 @@ function cdn_admin_other_settings_form(&$form_state) {
     '#default_value' => variable_get(CDN_HTTPS_SUPPORT_VARIABLE, FALSE),
     '#process'       => array('ctools_dependent_process'),
   );
+  
+   /* Begin text area for CDN hosts to use if SSL is enabled and this file is being served via SSL */
+  $format_variables = array(
+    '@format-url'        => '<' . t('URL') . '>',
+    '@format-extensions' => '<' . t('extensions') . '>',
+  );
+  $format_explanation_list_items = array(
+    t("<strong>@format-url</strong> is the CDN URL that should be used. E.g.:
+      '<code>http://cdn-a.com</code>'.", $format_variables),
+    t("<strong>@format-extensions</strong> is an <strong>optional</strong>
+      setting to limit which files should be served from a CDN. E.g.:
+      '<code>.css .jpg .jpeg .png</code>'.", $format_variables),
+  );
+  $example_list_items = array(
+    t('This would serve <em>all</em> files from a single CDN:
+      <pre><code>http://cdn-a.com</code></pre>'),
+    t("This would serve CSS and images from CDN A, .zip files from CDN B and
+       everything else from CDN C:
+       <pre><code>http://cdn-a.com|.css .jpg .jpeg .png\nhttp://cdn-b.com|.zip\nhttp://cdn-c.com</code></pre>"),
+  );
+   $form['https'][CDN_BASIC_HTTPS_MAPPING_VARIABLE] = array(
+    '#type'          => 'textarea',
+    '#title'         => t('HTTPS CDN mapping'),
+    '#description'   => t("Define which files are mapped to which CDN.<br />
+                           <br />
+                           Enter one mapping per line, in the format <strong>@format-url[|@format-extensions]</strong>:<br />
+                           !format-explanation-list
+                           <br />
+                           Sample mappings:
+                           !example-list", $format_variables + array(
+                             '!format-explanation-list' => theme('item_list', $format_explanation_list_items),
+                             '!example-list' => theme('item_list', $example_list_items),
+                          )),
+    '#size'          => 35,
+    '#default_value' => variable_get(CDN_BASIC_HTTPS_MAPPING_VARIABLE, ''),
+    '#process'       => array('ctools_dependent_process'),
+    '#dependency'    => array('radio:' . CDN_MODE_VARIABLE => array(CDN_MODE_BASIC)),
+  );
 
   $path_explanation = t(
     "Enter one file pattern per line. The '*' character is a wildcard.<br />
diff --git a/cdn.basic.inc b/cdn.basic.inc
index bb1718e..6649ba0 100644
--- a/cdn.basic.inc
+++ b/cdn.basic.inc
@@ -14,14 +14,21 @@
  *
  * @param $path
  *   The path to get the servers for.
+ * @param $https
+ *   Default: False
+ *   If true, SSL CDN list should be used instead of regular CDN list.
  */
-function cdn_basic_get_servers($path) {
+function cdn_basic_get_servers($path, $https=false) {
   static $mapping;
   $servers = array();
 
   // We only need to parse the textual CDN mapping once into a lookup table.
   if (!isset($mapping)) {
-    $mapping = _cdn_basic_parse_raw_mapping(variable_get(CDN_BASIC_MAPPING_VARIABLE, ''));
+     if(!$https){
+       $mapping = _cdn_basic_parse_raw_mapping(variable_get(CDN_BASIC_MAPPING_VARIABLE, ''));
+    }else{
+       $mapping = _cdn_basic_parse_raw_mapping(variable_get(CDN_BASIC_HTTPS_MAPPING_VARIABLE, ''));
+    }
   }
 
   // Parse the file extension from the given path; convert it to lower case.
diff --git a/cdn.module b/cdn.module
index e5a018d..8a28add 100644
--- a/cdn.module
+++ b/cdn.module
@@ -38,6 +38,7 @@ define('CDN_EXCEPTION_AUTH_USERS_BLACKLIST_DEFAULT', '');
 
 // Variables for basic mode.
 define('CDN_BASIC_MAPPING_VARIABLE', 'cdn_basic_mapping');
+define('CDN_BASIC_HTTPS_MAPPING_VARIABLE', 'cdn_basic_https_mapping');
 
 // Variables for advanced mode.
 define('CDN_ADVANCED_SYNCED_FILES_DB_VARIABLE', 'cdn_advanced_synced_files_db');
@@ -111,8 +112,10 @@ function cdn_file_url_alter(&$path) {
     cdn_load_include(($mode == CDN_MODE_BASIC) ? 'basic' : 'advanced');
 
     // Depending on the mode, use a different function to get the servers on
-    // which the file is available.
-    $servers = ($mode == CDN_MODE_BASIC) ? cdn_basic_get_servers($path) : cdn_advanced_get_servers($path);
+    // which the file is available.If the current page is being served via HTTPS,
+    // and the CDN supports HTTPS, then use the HTTPS file URL.
+    $use_secure_server_list = ($is_https_page && $https_support)?true:false;
+    $servers = ($mode == CDN_MODE_BASIC) ? cdn_basic_get_servers($path, $use_secure_server_list) : cdn_advanced_get_servers($path);
 
     // The file is not available on any server.
     if (count($servers) == 0) {
@@ -142,12 +145,6 @@ function cdn_file_url_alter(&$path) {
       $server  = $servers[0]['server'];
     }
 
-    // If the current page is being served via HTTPS, and the CDN supports
-    // HTTPS, then use the HTTPS file URL.
-    if ($is_https_page && $https_support) {
-      $cdn_url = preg_replace('/^http/', 'https', $cdn_url);
-    }
-
     // If the user can access it, add this to the per-page statistics.
     if ($stats) {
       $end = microtime();
