<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="description" content="A {{ .StatusCode }} {{ .StatusText }} error has occurred when trying to fetch content from the IPFS network.">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="shortcut icon" href="data:image/x-icon;base64, " />
  <title>{{ .StatusCode }} {{ .StatusText }}</title>
  <link rel="stylesheet">
</head>
<body>
  <header></header>
  <main id="main">
    <header>
      <strong>{{ .StatusCode }} {{ .StatusText }}</strong>
    </header>
    <section class="container">
      {{ if eq .StatusCode 400 }}
        <p>Your request is invalid. Please check the error below for more information.</p>
      {{ else if eq .StatusCode 404 }}
        <p>The content path you requested cannot be found. There's likely an invalid or missing DAG node.</p>
      {{ else if eq .StatusCode 406 }}
        <p>This gateway is unable to return the data in the format requested by the client.</p>
      {{ else if eq .StatusCode 410 }}
        <p>This gateway refuses to return the requested data.</p>
      {{ else if eq .StatusCode 412 }}
        <p>This gateway is unable to return the requested data under the conditions sent by the client.</p>
      {{ else if eq .StatusCode 429 }}
        <p>There are too many pending requests. Please wait some time and try again.</p>
      {{ else if eq .StatusCode 451 }}
        <p>This gateway is not allowed to return the requested data due to legal reasons.</p>
      {{ else if eq .StatusCode 500 }}
        <p>This gateway was unable to return the requested data due to an internal error. Please check the error below for more information.</p>
      {{ else if eq .StatusCode 502 }}
        <p>The gateway backend was unable to fulfill your request due to an error.</p>
      {{ else if eq .StatusCode 504 }}
        <p>This gateway is taking too long to fetch content from content providers. Please check the error below for more information.</p>

        {{ if and .RootCID .FailedCID (ne .RootCID .FailedCID) }}
          <p><strong>Note:</strong> The timeout occurred while fetching a sub-resource (CID: <code>{{ .FailedCID }}</code>) of the root content (CID: <code>{{ .RootCID }}</code>).</p>
        {{ end }}

      {{ else if eq .StatusCode 506 }}
        <p>The gateway backend was unable to fulfill your request at this time. Try again later.</p>
      {{ end }}

      <pre class="terminal wrap">{{ .Error }}</pre>

      <p>How you can proceed:</p>
      <ul>
        <li>Check the <a href="https://discuss.ipfs.tech/c/help/13" target="_blank" rel="noopener noreferrer">Discussion Forums</a> for similar errors.</li>
        <li>Try diagnosing your request with the <a href="https://docs.ipfs.tech/reference/diagnostic-tools/" target="_blank" rel="noopener noreferrer">diagnostic tools</a>.</li>
        <li>Self-host and run an <a href="https://docs.ipfs.tech/concepts/ipfs-implementations/" target="_blank" rel="noopener noreferrer">IPFS client</a> that verifies your data.</li>
        {{ if or (eq .StatusCode 400) (eq .StatusCode 404) }}
          <li>Inspect the <a href="https://cid.ipfs.tech/" target="_blank" rel="noopener noreferrer">CID</a> or <a href="https://explore.ipld.io/" target="_blank" rel="noopener noreferrer">DAG</a>.</li>
        {{ end }}
      </ul>

      <div class="buttons">
        <button onclick="document.querySelector('#main .container').innerHTML = '<p>Retrying, please wait...</p>'; window.location.reload(true)"
                class="button retry-button">
          Retry
        </button>
        {{ if and (eq .StatusCode 504) .FailedCID .DiagnosticServiceURL }}
          <a href="{{ .DiagnosticServiceURL }}?cid={{ .FailedCID }}"
             target="_blank"
             rel="noopener noreferrer"
             class="button diagnose-button">
            Check CID retrievability
          </a>
        {{ end }}
      </div>
    </section>
  </main>
</body>
</html>
