diff --git a/cloud_files.module b/cloud_files.module
index 710b8f9..9a63812 100644
--- a/cloud_files.module
+++ b/cloud_files.module
@@ -113,6 +113,7 @@ function cloud_files_admin() {
   $rackspace_cloud_api_key = variable_get('rackspace_cloud_api_key');
   $rackspace_cloud_container = variable_get('rackspace_cloud_container');
   $rackspace_cloud_cdn_domain = variable_get('rackspace_cloud_cdn_domain');
+  $rackspace_cloud_cdn_ssl_domain = variable_get('rackspace_cloud_cdn_ssl_domain');
   
   $form['rackspace_cloud_username'] = array(
     '#type' => 'textfield',
@@ -161,12 +162,22 @@ function cloud_files_admin() {
     '#description' => t('The container domain. Enter a custom CNAME here. Leave this empty to get the default domain of the selected container.'),
     '#default_value' => $rackspace_cloud_cdn_domain,
   );
+  
+  $form['rackspace_cloud_cdn_ssl_domain'] = array(
+    '#type' => 'value',
+    '#title' => t('SSL Domain'),
+    '#description' => t('The container ssl domain. Enter a custom CNAME here. Leave this empty to get the default domain of the selected container.'),
+    '#default_value' => $rackspace_cloud_cdn_ssl_domain,
+  );
+  
   //if there is a domain set, allow it to be updated
   //this is so it is first set to the container domain name
   //but can be updated to a custom CNAME
   if ($rackspace_cloud_cdn_domain) {
     $form['rackspace_cloud_cdn_domain']['#type'] = 'textfield';
-    $form['rackspace_cloud_cdn_domain']['#required'] = TRUE;
+  }
+  if ($rackspace_cloud_cdn_ssl_domain) {
+    $form['rackspace_cloud_cdn_ssl_domain']['#type'] = 'textfield';
   }
 
   $form['rackspace_cloud_debug'] = array(
@@ -193,6 +204,7 @@ function cloud_files_admin_validate($form, &$form_state) {
     $apikey = $form_state['values']['rackspace_cloud_api_key'] ? $form_state['values']['rackspace_cloud_api_key'] : variable_get('rackspace_cloud_api_key');
     $container = $form_state['values']['rackspace_cloud_container'];
     $rackspace_cloud_cdn_domain = $form_state['values']['rackspace_cloud_cdn_domain'];
+    $rackspace_cloud_cdn_ssl_domain = $form_state['values']['rackspace_cloud_cdn_ssl_domain'];
 
     //if using Other authentication URL, set its value from the text field
     if ($form_state['values']['rackspace_cloud_auth_url'] == 'other') {
@@ -225,11 +237,12 @@ function cloud_files_admin_validate($form, &$form_state) {
     }
 
     //if there is not a domain set, get the container domain
-    if (!$rackspace_cloud_cdn_domain) {
+    if (!$rackspace_cloud_cdn_domain || !$rackspace_cloud_cdn_ssl_domain) {
       try {
         $conn = new CF_Connection($auth);
         $container = $conn->get_container($container);
         $form_state['values']['rackspace_cloud_cdn_domain'] = str_replace(array('http://', 'https://'), '', $container->cdn_uri);
+        $form_state['values']['rackspace_cloud_cdn_ssl_domain'] = str_replace(array('http://', 'https://'), '', $container->cdn_ssl_uri);
       } catch (Exception $e) {
         form_set_error('rackspace_cloud_container', t('Container does not exist.'));
       }
diff --git a/rackspacecloudfiles_streams.inc b/rackspacecloudfiles_streams.inc
index 959d036..dbadb9b 100644
--- a/rackspacecloudfiles_streams.inc
+++ b/rackspacecloudfiles_streams.inc
@@ -170,9 +170,15 @@ class RackspaceCloudFilesStreamWrapper implements DrupalStreamWrapperInterface {
         }
       }
     }
+    
+    global $is_https;
+    if ($is_https) {
+      return 'https://' . variable_get('rackspace_cloud_cdn_ssl_domain') . '/' . $target;
+    }
+    else {
+      return 'http://' . variable_get('rackspace_cloud_cdn_domain') . '/' . $target;
+    }
 
-    $url = 'http://' . variable_get('rackspace_cloud_cdn_domain') . '/' . $target;
-    return $url;
   }
 
   /**
@@ -826,8 +832,15 @@ class RackspaceCloudFilesStreamWrapper implements DrupalStreamWrapperInterface {
     if (variable_get('rackspace_cloud_debug')) {
       watchdog("cloud_files", "executing getDirectoryPath", NULL, WATCHDOG_DEBUG);
     }
+    
+    global $is_https;
+    if ($is_https) {
+      return 'https://' . variable_get('rackspace_cloud_cdn_ssl_domain');
+    }
+    else {
+      return 'http://' . variable_get('rackspace_cloud_cdn_domain');
+    }
 
-    return "http://" . variable_get('rackspace_cloud_cdn_domain');
   }
   
   public function add_fileinfo($uri, $filemime, $filesize) {
