diff --git a/authcache.module b/authcache.module
index f16cdfe..bbace6c 100644
--- a/authcache.module
+++ b/authcache.module
@@ -692,7 +692,7 @@ function authcache_key_lifetime() {
  * @see hook_authcache_cookie_alter()
  */
 function authcache_fix_cookies($account = NULL) {
-  global $user;
+  global $user, $cookie_domain, $is_https;
 
   if (!isset($account)) {
     $account = $user;
@@ -706,8 +706,8 @@ function authcache_fix_cookies($account = NULL) {
     'value' => NULL,
     'lifetime' => authcache_key_lifetime(),
     'path' => ini_get('session.cookie_path'),
-    'domain' => ini_get('session.cookie_domain'),
-    'secure' => ini_get('session.cookie_secure') == '1',
+    'domain' => $cookie_domain,
+    'secure' => $is_https,
     'httponly' => FALSE,
   );
 
