53 lines
3.6 KiB
HTML
53 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta content="width=device-width, initial-scale=1" charset="utf-8" />
|
|
<link rel="icon" href="/assets/askiiart.gif" type="image/icon">
|
|
<title>300 Addendum</title>
|
|
<link href="/style.css" type="text/css" rel="stylesheet" />
|
|
<link href="/prism.css" rel="stylesheet" />
|
|
</head>
|
|
<body class="line-numbers">
|
|
<h1 id="addendum">300 Addendum</h1>
|
|
<p>Still not the movie. Still a nerd.</p>
|
|
<hr />
|
|
<p>So let's figure out how to add the <code>Link</code> header
|
|
for 300 Multiple Choices. As a reminder, <a
|
|
href="https://httpwg.org/specs/rfc9110.html#status.300">here's
|
|
the spec</a>:</p>
|
|
<blockquote>
|
|
<p>It is possible to communicate the list using a set of Link
|
|
header fields <em><a
|
|
href="https://httpwg.org/specs/rfc9110.html#RFC8288">RFC5988</a></em>,
|
|
each with a relationship of "alternate", though deployment is a
|
|
chicken-and-egg problem.</p>
|
|
</blockquote>
|
|
<p>So based off some examples for the <code>Link</code> header
|
|
in general on <a
|
|
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link">Mozilla's
|
|
docs</a>, and for 300 <code>Link</code> headers specifically <a
|
|
href="https://http.dev/300">on http.dev</a>, this is how you
|
|
make the <code>Link</code> headers for a 300:</p>
|
|
<div class="sourceCode" id="cb1"><pre
|
|
class="language-txt"><code class="language-default"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>Link: </relative/link/like/this>; rel="alternate"</span>
|
|
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>Link: <https://site-one.net/blah/blah/blah>; rel="alternate"</span></code></pre></div>
|
|
<p>Unfortunately, there doesn't seem to be an option for
|
|
specifying a preferred choice in the <code>Link</code> header.
|
|
So I'll just set mine to these:</p>
|
|
<div class="sourceCode" id="cb2"><pre
|
|
class="language-txt"><code class="language-default"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>Link: <https://git.askiiart.net/askiiart/askiiart-net>; rel="alternate"</span>
|
|
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>Link: <https://github.com/askiiart/askiiart.github.io>; rel="alternate"</span></code></pre></div>
|
|
<p>And so here's the new nginx config:</p>
|
|
<pre class="language-nginx"><code> location /.git {
|
|
add_header Location "https://git.askiiart.net/askiiart/askiiart-net";
|
|
add_header Link '<https://git.askiiart.net/askiiart/askiiart-net>; rel="alternate"; "';
|
|
add_header Link '<https://github.com/askiiart/askiiart.github.io>; rel="alternate"; "';
|
|
return 300 '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></head><body><a href="https://git.askiiart.net/askiiart/askiiart-net">Self-hosted</a><br><a href="https://github.com/askiiart/askiiart-net">GitHub</a></body></html>';
|
|
}</code></pre>
|
|
<p><a href="/blog/300.html">Main post</a></p>
|
|
<script src="/prism.js"></script>
|
|
</body>
|
|
<footer>
|
|
<p><a href="https://git.askiiart.net/askiiart/askiiart-net">code</a> (<a href="https://github.com/askiiart/askiiart.github.io">mirror</a>) <a href="/feed.xml">rss</a> <a href="/pubkey.asc">pubkey</a></p>
|
|
</footer>
|
|
</html>
|