function drupal_get_http_header

8.x drupal_get_http_header($name = NULL)

Gets the HTTP response headers for the current page.


$name: An HTTP header name. If omitted, all headers are returned as name/value pairs. If an array value is FALSE, the header has been unset.

Return value

A string containing the header value, or FALSE if the header has been set, or NULL if the header has not been set.


Header handling is being shifted to a Symfony response object.

3 calls to drupal_get_http_header()
drupal_send_headers in drupal/core/includes/
Sends the HTTP response headers that were previously set, adding defaults.
drupal_serve_page_from_cache in drupal/core/includes/
Sets HTTP headers in preparation for a cached page response.
FinishResponseSubscriber::onRespond in drupal/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
Sets extra headers on successful responses.


drupal/core/includes/, line 1108
Functions that need to be loaded on every Drupal request.


function drupal_get_http_header($name = NULL) {
  $headers = &drupal_static('drupal_http_headers', array());
  if (isset($name)) {
    $name = strtolower($name);
    return isset($headers[$name]) ? $headers[$name] : NULL;
  else {
    return $headers;