DevToolsmith

Link Header

The Link response header expresses links in a header: preload hints, preconnects, pagination and canonical URLs.

Type
Response header
Category
Requests, redirects and more
Defined in
RFC 8288

Syntax

Link: <url>; rel="<relation>"[; <param>=<value>], …

How Link works

It works like <link> elements in HTML, but arrives before the body, so the browser can start fetching critical CSS and fonts sooner. Sent in a 103 Early Hints response, it starts those fetches while the server is still generating the page. APIs use it for pagination (rel="next"), and it can declare a canonical URL for PDFs and other non-HTML files.

Examples

Preload a font and preconnect to a CDN
Link: </fonts/inter.woff2>; rel=preload; as=font; type="font/woff2"; crossorigin, <https://cdn.example.com>; rel=preconnect
Pagination (GitHub API style)
Link: <https://api.example.com/items?page=3>; rel="next", <https://api.example.com/items?page=50>; rel="last"
Canonical URL for a PDF
Link: <https://example.com/whitepaper>; rel="canonical"

Check it

curl -sI https://example.com | grep -i '^link:'

Paste a full set of response headers into the HTTP header checker to get every header explained and common mistakes flagged.

Related headers

  • Access-Control-Expose-Headers: lets JavaScript read extra response headers from a cross-origin response.
  • Cache-Control: tells browsers, CDNs and proxies whether a response may be stored, by whom, and for how long.
  • Location: gives the URL to redirect to (with 3xx) or of a newly created resource (with 201).

More requests, redirects and more headers

Retry-After , User-Agent , Host , Sec-Fetch-Site , Clear-Site-Data , Server-Timing .

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What does the Link header do?

The Link response header expresses links in a header: preload hints, preconnects, pagination and canonical URLs. It works like <link> elements in HTML, but arrives before the body, so the browser can start fetching critical CSS and fonts sooner. Sent in a 103 Early Hints response, it starts those fetches while the server is still generating the page. APIs use it for pagination (rel="next"), and it can declare a canonical URL for PDFs and other non-HTML files.

How do I see the Link header?

Run "curl -sI https://example.com" to print a response’s headers, or open the Network tab in your browser’s dev tools and select the request. Paste the headers into the HTTP header checker on this site to get each one explained.