askiiart-net/blog/300-link-addendum.html

54 lines
3.6 KiB
HTML
Raw Normal View History

2023-12-06 12:55:40 -06:00
<!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: &lt;/relative/link/like/this&gt;; rel=&quot;alternate&quot;</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>Link: &lt;https://site-one.net/blah/blah/blah&gt;; rel=&quot;alternate&quot;</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: &lt;https://git.askiiart.net/askiiart/askiiart-net&gt;; rel=&quot;alternate&quot;</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>Link: &lt;https://github.com/askiiart/askiiart.github.io&gt;; rel=&quot;alternate&quot;</span></code></pre></div>
<p>And so here's the new nginx config:</p>
<pre class="language-nginx"><code> location /.git {
add_header Location &quot;https://git.askiiart.net/askiiart/askiiart-net&quot;;
add_header Link &#39;&lt;https://git.askiiart.net/askiiart/askiiart-net&gt;; rel=&quot;alternate&quot;; &quot;&#39;;
add_header Link &#39;&lt;https://github.com/askiiart/askiiart.github.io&gt;; rel=&quot;alternate&quot;; &quot;&#39;;
return 300 &#39;&lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;&lt;meta charset=&quot;utf-8&quot;&gt;&lt;/head&gt;&lt;body&gt;&lt;a href=&quot;https://git.askiiart.net/askiiart/askiiart-net&quot;&gt;Self-hosted&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;https://github.com/askiiart/askiiart-net&quot;&gt;GitHub&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;&#39;;
}</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>)&emsp;<a href="/feed.xml">rss</a>&emsp;<a href="/pubkey.asc">pubkey</a></p>
</footer>
</html>