{{ request.headers }}

The headers object is available on every page, and contains information regarding the headers sent with the request that may be useful for serving and rendering the page.

Properties

Specific headers may be accessed using {{ request.headers.headername }} or {{ request.headers['header-name'] }}.

You may also treat this object as a list containing all of the header names which may be iterated using a {% for %} loop. For more details, see the examples below:

string object_type
Will always be "headers".
true/false is_valid
Will always be true
List keys
A list of all of the individual header names sent with the request
number count
The number of headers sent with the request. This is probably not very interesting but there you go...

Examples

Origin: {{ request.headers.origin }}
{% for header in request.headers %}
    {{ header }}: {{ request.headers[header] }}
{% endfor %}
(This is functionally identical to the previous example)
{% for key in request.headers.keys %}
    {{ key }}: {{ request.headers[key] }}
{% endfor %}

Developer Overview

Liquid Markup