public function getHeaders()
 {
     $headers = $this->headers;
     Log::add($headers, 'headers raw');
     // For HTML content, overwrite upstream cache conf.
     if (isset($headers['Cache-Control'])) {
         if ($this->getContentType() == $this::CONTENT_TYPE_TEXT_HTML) {
             unset($headers['Cache-Control']);
         }
     } else {
         if ($this->getContentType() == $this::CONTENT_TYPE_OTHER) {
             $headers['Cache-Control'] = getCacheControlHeader(60 * 60, 60 * 60, 60 * 60 * 24);
         }
     }
     // If redirect, rewrite Location header.
     if (isset($headers['Location'])) {
         if (parse_url($headers['Location'], PHP_URL_HOST)) {
             TextExternalUrlFilters::applyAll($headers['Location']);
         }
         // Header redirects require full URLs, with scheme and host.
         if (!parse_url($headers['Location'], PHP_URL_HOST)) {
             $headers['Location'] = RedirectWhenBlockedFull::getBaseUrl(true) . ltrim($headers['Location'], '/');
         }
     }
     // Rewrite set-cookie headers (or remove if cookies disabled).
     if (isset($headers['Set-Cookie'])) {
         if (!Conf::$cookies_enabled) {
             unset($headers['Set-Cookie']);
         } else {
             if (is_array($headers['Set-Cookie'])) {
                 foreach ($headers['Set-Cookie'] as &$set_cookie) {
                     $set_cookie = $this->getFilteredSetCookie($set_cookie);
                 }
             } else {
                 $headers['Set-Cookie'] = $this->getFilteredSetCookie($headers['Set-Cookie']);
             }
         }
     }
     // Unset some.
     $skip = array('Connection', 'Content-Encoding', 'Transfer-Encoding', 'X-Original-Content-Encoding');
     foreach ($skip as $s) {
         if (isset($headers[$s])) {
             unset($headers[$s]);
         }
     }
     Log::add($headers, 'headers filtered');
     return $headers;
 }