CINXE.COM

Address IPFS on the web | IPFS Docs

<!doctype html><html lang="en-US"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Address IPFS on the web | IPFS Docs</title> <meta name="generator" content="VuePress 1.9.10"> <link rel="apple-touch-icon" sizes="180x180" href="../../apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="../../favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="../../favicon-16x16.png"> <link rel="manifest" href="../../manifest.json"> <link rel="mask-icon" href="../../safari-pinned-tab.svg" color="#3a0839"> <link rel="shortcut icon" href="../../favicon.ico"> <script defer data-domain="docs.ipfs.tech" src="https://plausible.io/js/plausible.js"></script><link rel="canonical" href="https://docs.ipfs.tech/how-to/address-ipfs-on-web/"> <meta name="description" content="Hands-on guides to using and developing with IPFS to build decentralized web apps and services."> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="msapplication-TileColor" content="#3a0839"> <meta name="msapplication-config" content="/browserconfig.xml"> <meta name="theme-color" content="#5bbad5"> <link rel="preload" href="../../assets/css/0.styles.bf49ba33.css" as="style"><link rel="preload" href="../../assets/js/app.576e9eab.js" as="script"><link rel="preload" href="../../assets/js/2.4d957bfb.js" as="script"><link rel="preload" href="../../assets/js/1.e5bd4a62.js" as="script"><link rel="preload" href="../../assets/js/88.232e42ef.js" as="script"><link rel="prefetch" href="../../assets/js/10.36ecc450.js"><link rel="prefetch" href="../../assets/js/100.2a04e206.js"><link rel="prefetch" href="../../assets/js/101.7d750bb8.js"><link rel="prefetch" href="../../assets/js/102.059e738b.js"><link rel="prefetch" href="../../assets/js/103.c4a772a0.js"><link rel="prefetch" href="../../assets/js/104.7a175e7b.js"><link rel="prefetch" href="../../assets/js/105.4907b5da.js"><link rel="prefetch" href="../../assets/js/106.68ec4141.js"><link rel="prefetch" href="../../assets/js/107.6b6cfe3e.js"><link rel="prefetch" href="../../assets/js/108.a3e080c2.js"><link rel="prefetch" href="../../assets/js/109.170493ff.js"><link rel="prefetch" href="../../assets/js/110.a2ccf025.js"><link rel="prefetch" href="../../assets/js/111.5bb74439.js"><link rel="prefetch" href="../../assets/js/112.6aa211a0.js"><link rel="prefetch" href="../../assets/js/113.a068d47b.js"><link rel="prefetch" href="../../assets/js/114.8bcb07cd.js"><link rel="prefetch" href="../../assets/js/115.0219bd2f.js"><link rel="prefetch" href="../../assets/js/116.03f3f039.js"><link rel="prefetch" href="../../assets/js/117.5056dd6d.js"><link rel="prefetch" href="../../assets/js/118.c67b9619.js"><link rel="prefetch" href="../../assets/js/119.9c8cde57.js"><link rel="prefetch" href="../../assets/js/120.d754db01.js"><link rel="prefetch" href="../../assets/js/121.7856de78.js"><link rel="prefetch" href="../../assets/js/122.2052ec05.js"><link rel="prefetch" href="../../assets/js/123.a044e213.js"><link rel="prefetch" href="../../assets/js/124.83f0eb7b.js"><link rel="prefetch" href="../../assets/js/125.9244b697.js"><link rel="prefetch" href="../../assets/js/126.1f75575b.js"><link rel="prefetch" href="../../assets/js/127.a2a7a337.js"><link rel="prefetch" href="../../assets/js/128.80db4419.js"><link rel="prefetch" href="../../assets/js/129.f920ef4e.js"><link rel="prefetch" href="../../assets/js/13.0bc1cd71.js"><link rel="prefetch" href="../../assets/js/130.c231cbfe.js"><link rel="prefetch" href="../../assets/js/131.1450e005.js"><link rel="prefetch" href="../../assets/js/132.4dca8686.js"><link rel="prefetch" href="../../assets/js/133.b19f4112.js"><link rel="prefetch" href="../../assets/js/134.2afdba3c.js"><link rel="prefetch" href="../../assets/js/135.84a5f740.js"><link rel="prefetch" href="../../assets/js/136.4458b008.js"><link rel="prefetch" href="../../assets/js/137.7a8852ed.js"><link rel="prefetch" href="../../assets/js/14.c7cbb382.js"><link rel="prefetch" href="../../assets/js/15.55139b89.js"><link rel="prefetch" href="../../assets/js/16.a321b674.js"><link rel="prefetch" href="../../assets/js/17.32021071.js"><link rel="prefetch" href="../../assets/js/18.1c6047e9.js"><link rel="prefetch" href="../../assets/js/19.73e0c29f.js"><link rel="prefetch" href="../../assets/js/20.0236f27b.js"><link rel="prefetch" href="../../assets/js/21.7e3ec3ed.js"><link rel="prefetch" href="../../assets/js/22.5895c40a.js"><link rel="prefetch" href="../../assets/js/23.b941d2e9.js"><link rel="prefetch" href="../../assets/js/24.0375b4c4.js"><link rel="prefetch" href="../../assets/js/25.05cde63b.js"><link rel="prefetch" href="../../assets/js/26.489f6ddf.js"><link rel="prefetch" href="../../assets/js/27.0f561f49.js"><link rel="prefetch" href="../../assets/js/28.7b582c33.js"><link rel="prefetch" href="../../assets/js/29.0cd0f0e1.js"><link rel="prefetch" href="../../assets/js/3.d4fbab88.js"><link rel="prefetch" href="../../assets/js/30.c0787294.js"><link rel="prefetch" href="../../assets/js/31.30f2a16d.js"><link rel="prefetch" href="../../assets/js/32.b6a7bac9.js"><link rel="prefetch" href="../../assets/js/33.8fbdd44a.js"><link rel="prefetch" href="../../assets/js/34.29e175d5.js"><link rel="prefetch" href="../../assets/js/35.9e694740.js"><link rel="prefetch" href="../../assets/js/36.a79fac89.js"><link rel="prefetch" href="../../assets/js/37.acc13ae7.js"><link rel="prefetch" href="../../assets/js/38.ec02a1eb.js"><link rel="prefetch" href="../../assets/js/39.d11aa502.js"><link rel="prefetch" href="../../assets/js/4.534c1876.js"><link rel="prefetch" href="../../assets/js/40.311063cb.js"><link rel="prefetch" href="../../assets/js/41.5d1fcada.js"><link rel="prefetch" href="../../assets/js/42.5439bf9d.js"><link rel="prefetch" href="../../assets/js/43.34e197e2.js"><link rel="prefetch" href="../../assets/js/44.0857a0d8.js"><link rel="prefetch" href="../../assets/js/45.dc5d5e19.js"><link rel="prefetch" href="../../assets/js/46.b1e08511.js"><link rel="prefetch" href="../../assets/js/47.f70f9ebf.js"><link rel="prefetch" href="../../assets/js/48.7a760128.js"><link rel="prefetch" href="../../assets/js/49.7c941e1a.js"><link rel="prefetch" href="../../assets/js/5.3a9152c4.js"><link rel="prefetch" href="../../assets/js/50.bce5c239.js"><link rel="prefetch" href="../../assets/js/51.cf2b6662.js"><link rel="prefetch" href="../../assets/js/52.ff946eed.js"><link rel="prefetch" href="../../assets/js/53.3b827e2c.js"><link rel="prefetch" href="../../assets/js/54.b4065b95.js"><link rel="prefetch" href="../../assets/js/55.a95d9aa6.js"><link rel="prefetch" href="../../assets/js/56.f73731e0.js"><link rel="prefetch" href="../../assets/js/57.66ce775d.js"><link rel="prefetch" href="../../assets/js/58.73ac8184.js"><link rel="prefetch" href="../../assets/js/59.3d069653.js"><link rel="prefetch" href="../../assets/js/6.af8ab9f3.js"><link rel="prefetch" href="../../assets/js/60.055f17c8.js"><link rel="prefetch" href="../../assets/js/61.1745576b.js"><link rel="prefetch" href="../../assets/js/62.1b998b1c.js"><link rel="prefetch" href="../../assets/js/63.a5a142b4.js"><link rel="prefetch" href="../../assets/js/64.d4d19062.js"><link rel="prefetch" href="../../assets/js/65.e55f2d17.js"><link rel="prefetch" href="../../assets/js/66.2b933661.js"><link rel="prefetch" href="../../assets/js/67.b4473f7b.js"><link rel="prefetch" href="../../assets/js/68.3eb1d121.js"><link rel="prefetch" href="../../assets/js/69.1140b7d7.js"><link rel="prefetch" href="../../assets/js/7.56ce43bc.js"><link rel="prefetch" href="../../assets/js/70.781a841a.js"><link rel="prefetch" href="../../assets/js/71.293690cb.js"><link rel="prefetch" href="../../assets/js/72.219abc33.js"><link rel="prefetch" href="../../assets/js/73.cc6e499e.js"><link rel="prefetch" href="../../assets/js/74.11dddef5.js"><link rel="prefetch" href="../../assets/js/75.f8d64ce5.js"><link rel="prefetch" href="../../assets/js/76.fbaacb46.js"><link rel="prefetch" href="../../assets/js/77.67b2ecd1.js"><link rel="prefetch" href="../../assets/js/78.b6f5ef76.js"><link rel="prefetch" href="../../assets/js/79.61dbff91.js"><link rel="prefetch" href="../../assets/js/8.ae30cd98.js"><link rel="prefetch" href="../../assets/js/80.c3607ef6.js"><link rel="prefetch" href="../../assets/js/81.f891f703.js"><link rel="prefetch" href="../../assets/js/82.a5190de7.js"><link rel="prefetch" href="../../assets/js/83.c6fec0d3.js"><link rel="prefetch" href="../../assets/js/84.fca32737.js"><link rel="prefetch" href="../../assets/js/85.af8b6c91.js"><link rel="prefetch" href="../../assets/js/86.04d4f00e.js"><link rel="prefetch" href="../../assets/js/87.b1e94cf8.js"><link rel="prefetch" href="../../assets/js/89.c660995c.js"><link rel="prefetch" href="../../assets/js/9.5e62c730.js"><link rel="prefetch" href="../../assets/js/90.8693c7a6.js"><link rel="prefetch" href="../../assets/js/91.66af6053.js"><link rel="prefetch" href="../../assets/js/92.7ca0849f.js"><link rel="prefetch" href="../../assets/js/93.8e519493.js"><link rel="prefetch" href="../../assets/js/94.9213dc80.js"><link rel="prefetch" href="../../assets/js/95.f123ff56.js"><link rel="prefetch" href="../../assets/js/96.eeba1410.js"><link rel="prefetch" href="../../assets/js/97.4cb38de2.js"><link rel="prefetch" href="../../assets/js/98.435bea58.js"><link rel="prefetch" href="../../assets/js/99.cc9bb8be.js"><link rel="prefetch" href="../../assets/js/vendors~docsearch.344a1317.js"> <link rel="stylesheet" href="../../assets/css/0.styles.bf49ba33.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="../../images/ipfs-logo.svg" alt="IPFS Docs" class="logo"> <span class="site-name can-hide">IPFS Docs</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="../../install/" class="nav-link"> Get Started </a></div><div class="nav-item"><a href="../../concepts/" class="nav-link"> Concepts </a></div><div class="nav-item"><a href="../../how-to/" class="nav-link router-link-active"> Guides </a></div><div class="nav-item"><a href="../../reference/" class="nav-link"> Reference </a></div><div class="nav-item"><a href="../../project/" class="nav-link"> Project </a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Case Studies" class="dropdown-title"><span class="title">Case Studies</span> <span class="arrow down"></span></button> <button type="button" aria-label="Case Studies" class="mobile-dropdown-title"><span class="title">Case Studies</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="../../case-studies/arbol/" class="nav-link"> Arbol </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/audius.html" class="nav-link"> Audius </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/fleek.html" class="nav-link"> Fleek </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/likecoin.html" class="nav-link"> LikeCoin </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/morpheus.html" class="nav-link"> Morpheus.Network </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/snapshot.html" class="nav-link"> Snapshot </a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="../../install/" class="nav-link"> Get Started </a></div><div class="nav-item"><a href="../../concepts/" class="nav-link"> Concepts </a></div><div class="nav-item"><a href="../../how-to/" class="nav-link router-link-active"> Guides </a></div><div class="nav-item"><a href="../../reference/" class="nav-link"> Reference </a></div><div class="nav-item"><a href="../../project/" class="nav-link"> Project </a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Case Studies" class="dropdown-title"><span class="title">Case Studies</span> <span class="arrow down"></span></button> <button type="button" aria-label="Case Studies" class="mobile-dropdown-title"><span class="title">Case Studies</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="../../case-studies/arbol/" class="nav-link"> Arbol </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/audius.html" class="nav-link"> Audius </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/fleek.html" class="nav-link"> Fleek </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/likecoin.html" class="nav-link"> LikeCoin </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/morpheus.html" class="nav-link"> Morpheus.Network </a></li><li class="dropdown-item"><!----> <a href="../../case-studies/snapshot.html" class="nav-link"> Snapshot </a></li></ul></div></div> <!----></nav> <ul class="sidebar-links"><li><a href="../../how-to/desktop-app/" class="sidebar-link">IPFS Desktop Tutorial</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>IPFS Kubo Tutorials</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Manage files</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Work with peers</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Websites on IPFS</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>IPFS in the browser</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="../../how-to/address-ipfs-on-web/" aria-current="page" class="active sidebar-link">Address IPFS on the web</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#ipfs-addressing-in-brief" class="sidebar-link">IPFS addressing in brief</a></li><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#http-gateways" class="sidebar-link">HTTP gateways</a></li><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#path-gateway" class="sidebar-link">Path gateway</a></li><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#subdomain-gateway" class="sidebar-link">Subdomain gateway</a></li><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#dnslink-gateway" class="sidebar-link">DNSLink gateway</a></li><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#native-urls" class="sidebar-link">Native URLs</a></li><li class="sidebar-sub-header"><a href="../../how-to/address-ipfs-on-web/#further-resources" class="sidebar-link">Further resources</a></li></ul></li><li><a href="../../how-to/browser-tools-frameworks/" class="sidebar-link">Browser tools and frameworks</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>IPNS</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>IPFS Gateway</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>IPFS Companion</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>IPFS &#x26; Blockchain Networks</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Privacy and Encryption</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page" data-v-b274761c=""> <div class="theme-default-content content__default" data-v-b274761c=""><h1 id="address-ipfs-on-the-web"><a href="#address-ipfs-on-the-web" class="header-anchor">#</a> Address IPFS on the web</h1> <p>This page describes how to address a node in the IPFS network. Clients that support the IPFS protocol can ignore HTTP details and retrieve data natively, while those that don't can fetch the resource from HTTP server at <code>ipfs.io</code> gateway, as long as they have the content identifier (CID). When <code>ipfs.io</code> or any other <a href="https://ipfs.github.io/public-gateway-checker/" target="_blank" rel="noopener noreferrer">public gateway<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> goes down, IPFS aware clients will still be able to fetch the content from the IPFS network as long as at least one node still provides the data behind the CID to the network:</p> <p>Addresses using a gateway use the following form, where <code>&#x3C;gateway></code> is the gateway address, and <code>&#x3C;CID></code> is the content identifier</p> <div class="language-shell extra-class"><pre class="language-shell"><code>https://<span class="token operator">&#x3C;</span>gateway<span class="token operator">></span>/ipfs/<span class="token operator">&#x3C;</span>CID<span class="token operator">></span> </code></pre></div><p>For example:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>https://ipfs.io/ipfs/bafybeihkoviema7g3gxyt6la7vd5ho32ictqbilu3wnlo3rs7ewhnp7lly </code></pre></div><p>A <a href="https://docs.ipfs.io/install/" target="_blank" rel="noopener noreferrer">self-hosted local gateway<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> can also be used, instead of <code>ipfs.io</code>.</p> <h2 id="ipfs-addressing-in-brief"><a href="#ipfs-addressing-in-brief" class="header-anchor">#</a> IPFS addressing in brief</h2> <p>In IPFS, content addresses are path-like; that is, the addresses are components separated by slashes. The first component is the protocol, which tells you how to interpret everything after it.</p> <p>Content referenced by a hash may have named links. For example, a Git commit has a link named <code>parent</code>, which is really just a pointer to the hash of another Git commit. Components in an IPFS address after the CID are the named links.</p> <p>Since content addresses aren’t URLs, using them in a web browser requires reformatting. The options for this are:</p> <ol><li><p>A <a href="#path-gateway">path gateway</a></p> <div class="language-shell extra-class"><pre class="language-shell"><code>https://<span class="token operator">&#x3C;</span>gateway-host<span class="token operator">></span>/ipfs/<span class="token operator">&#x3C;</span>cid<span class="token operator">></span>/<span class="token operator">&#x3C;</span>path<span class="token operator">></span> </code></pre></div></li> <li><p>A <a href="#subdomain-gateway">subdomain gateway</a>, for hosting websites with origin isolation. This is more secure, but harder to set up.</p> <div class="language-shell extra-class"><pre class="language-shell"><code>https://<span class="token operator">&#x3C;</span>cid<span class="token operator">></span>.ipfs.<span class="token operator">&#x3C;</span>gateway-host<span class="token operator">></span>/<span class="token operator">&#x3C;</span>path<span class="token operator">></span> </code></pre></div></li> <li><p>Native protocol handlers, when you don't want to hard-code a specific HTTP gateway in the URI:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>ipfs://<span class="token operator">&#x3C;</span>cid<span class="token operator">></span>/<span class="token operator">&#x3C;</span>path<span class="token operator">></span> </code></pre></div><div class="language-shell extra-class"><pre class="language-shell"><code>ipns://<span class="token operator">&#x3C;</span>ipns-name<span class="token operator">></span>/<span class="token operator">&#x3C;</span>path<span class="token operator">></span> </code></pre></div></li></ol> <h2 id="http-gateways"><a href="#http-gateways" class="header-anchor">#</a> HTTP gateways</h2> <p>HTTP gateways allow tools that "speak" HTTP but do not speak "IPFS" to communicate. They are the first stage of the upgrade path for the web. <a href="../../concepts/ipfs-gateway/">More information about IPFS Gateways</a>.</p> <p>One downside of HTTP gateways is centralization. Location-based addressing of a gateway depends on both DNS and HTTPS/TLS, which relies on trust in <a href="https://en.wikipedia.org/wiki/Certificate_authority" target="_blank" rel="noopener noreferrer">certificate authorities<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> (CAs) and <a href="https://en.wikipedia.org/wiki/Public_key_infrastructure" target="_blank" rel="noopener noreferrer">public key infrastructure<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> (PKI). In the long term, these issues should be mitigated by the use of opportunistic protocol upgrade schemes.</p> <h3 id="protocol-upgrade"><a href="#protocol-upgrade" class="header-anchor">#</a> Protocol upgrade</h3> <p>Long term, deserialized responses returned by a public HTTP gateway are used only as a fallback when no native implementation of IPFS is available.</p> <p>IPFS clients, user agents, tools and extensions should detect CIDs in URLs, DNSLinks or IPFS content paths and resolve them directly over the IPFS protocol. This ensures that the retrieved data matches the expected hash.</p> <p>Examples of user agents that support IPFS natively are:</p> <ul><li>A standard web browser with <a href="https://docs.ipfs.tech/install/ipfs-companion/" target="_blank" rel="noopener noreferrer">IPFS Companion<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> installed next to an IPFS node, such as <a href="https://docs.ipfs.tech/install/ipfs-desktop/" target="_blank" rel="noopener noreferrer">IPFS Desktop<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h2 id="path-gateway"><a href="#path-gateway" class="header-anchor">#</a> Path gateway</h2> <p>A path gateway is the most basic scheme. In this scheme, a URL path used for content addressing is effectively a resource name without a canonical location. The HTTP server provides the location part, which makes it possible for browsers to interpret an IPFS content path relative to the current server and work without need for any conversion. Given a gateway host address (i.e. <code>ipfs.io</code>), and a path to the resource, (i.e <code>/path/to/resource</code>), a <a href="../../concepts/content-addressing/">CID</a> (<code>&#x3C;cid></code>), IPNS ID (<code>&#x3C;ipnsid></code>) or <a href="../../concepts/dnslink/">DNSLink</a> (<code>&#x3C;dnslink></code>) can all be used.</p> <p><a href="#cid">Using a CID</a> <a href="#ipns">Using IPNS</a> <a href="#dnslink">Using DNSLink</a></p> <h3 id="cid"><a href="#cid" class="header-anchor">#</a> CID</h3> <p>Given a CID <code>&#x3C;cid></code>, a URL path can be constructed as follows:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://&#x3C;gateway-host>.tld/ipfs/&#x3C;cid>/path/to/resource </code></pre></div><p>Example:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://ipfs.io/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html https://ipfs.io/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Mars.html </code></pre></div><h3 id="ipns"><a href="#ipns" class="header-anchor">#</a> IPNS</h3> <p>Given an <a href="https://specs.ipfs.tech/ipns/ipns-record/#ipns-name" target="_blank" rel="noopener noreferrer">IPNS name<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <code>&#x3C;ipns-name></code>, a URL path can be constructed as follows:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://&#x3C;gateway-host>.tld/ipns/&#x3C;ipns-name>/path/to/resource </code></pre></div><p>Example:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://ipfs.io/ipns/k51qzi5uqu5dlvj2baxnqndepeb86cbk3ng7n3i46uzyxzyqj2xjonzllnv0v8 </code></pre></div><h3 id="dnslink"><a href="#dnslink" class="header-anchor">#</a> DNSLink</h3> <p>Given a DNS name with a <a href="https://dnslink.dev/" target="_blank" rel="noopener noreferrer">DNSLink<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> text record <code>&#x3C;dnslink></code>, a URL path can be constructed as follows:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://&#x3C;gateway-host>.tld/ipns/&#x3C;dnslink>/path/to/resource </code></pre></div><p>Example:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://ipfs.io/ipns/tr.wikipedia-on-ipfs.org/wiki/Anasayfa.html </code></pre></div><div class="custom-block danger"><p class="custom-block-title">DANGER</p> <p>In this scheme, all pages share a <a href="https://en.wikipedia.org/wiki/Same-origin_policy" target="_blank" rel="noopener noreferrer">single origin<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>. As such, this type of gateway should only be used when site isolation does not matter. Examples include static content without cookies, local storage, or APIs that require user permission.</p> <p>When in doubt, use a <a href="#subdomain-gateway">subdomain gateway</a>.</p></div> <h2 id="subdomain-gateway"><a href="#subdomain-gateway" class="header-anchor">#</a> Subdomain gateway</h2> <p>When <a href="https://en.wikipedia.org/wiki/Same-origin_policy" target="_blank" rel="noopener noreferrer">origin-based security<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> is needed, a <a href="../../concepts/content-addressing/#identifier-formats">CIDv1</a> in a case-insensitive encoding such as Base32 or Base36 should be used in the subdomain:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://&#x3C;cidv1b32>.ipfs.&#x3C;gateway-host>.tld/path/to/resource </code></pre></div><p>Examples:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq.ipfs.dweb.link/wiki/ http://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq.ipfs.localhost:8080/wiki/Vincent_van_Gogh.html </code></pre></div><div class="custom-block warning"><p class="custom-block-title">Known issues</p> <ol><li>Some browsers and other user agents force lowercase for the authority part of URLs, breaking case-sensitive CIDs before the HTTP gateway has a chance to read them.</li> <li>DNS label length is limited to 63 characters (<a href="https://datatracker.ietf.org/doc/html/rfc1034#page-7" target="_blank" rel="noopener noreferrer">RFC 1034<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>)</li></ol> <p>Due to these limitations, the use of short, case-insensitive CIDv1 in a subdomain context is advised. Base32 is the safe default; the less-popular Base36 can be used for longer ED25519 libp2p keys.</p> <p>See the next section to learn how to convert an existing CIDv0 to a DNS-safe representation.</p></div> <h4 id="native-support-in-kubo-and-rainbow"><a href="#native-support-in-kubo-and-rainbow" class="header-anchor">#</a> Native support in Kubo and Rainbow</h4> <p><a href="https://dist.ipfs.tech/#kubo" target="_blank" rel="noopener noreferrer">Kubo<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> provides native support for subdomain gateway, see <a href="https://github.com/ipfs/kubo/blob/master/docs/config.md#gateway-recipes" target="_blank" rel="noopener noreferrer"><code>Gateway</code> recipes<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> with ready to use one-liners for most common use cases.</p> <p>If you need a high-performance HTTP gateway, you may want to deploy <a href="https://github.com/ipfs/rainbow/" target="_blank" rel="noopener noreferrer">Rainbow<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> instead. Rainbow is a specialized IPFS HTTP gateway which makes it easier to scale HTTP retrieval and isolate it from your Bitswap provider backend, such as Kubo or IPFS Cluster. See <code>rainbow --help</code> for relevant configuration (<code>--subdomain-gateway-domains</code> and <code>RAINBOW_SUBDOMAIN_GATEWAY_DOMAINS</code>).</p> <h4 id="cid-conversion-for-subdomains"><a href="#cid-conversion-for-subdomains" class="header-anchor">#</a> CID conversion for subdomains</h4> <p>If you have content identified by an older CIDv0, there are an automatic and a manual option to safely represent it as CIDv1 for use in subdomains and other case-insensitive contexts.</p> <ul><li><a href="#automatic--leverage-the-gateway-in-kubo">Automatic</a></li> <li><a href="#manual--use-cidipfsio-or-the-command-line">Manual</a></li></ul> <h5 id="automatic-leverage-the-gateway-in-kubo"><a href="#automatic-leverage-the-gateway-in-kubo" class="header-anchor">#</a> Automatic — leverage the gateway in Kubo</h5> <p>Using a subdomain gateway as a drop-in replacement for a path one removes the need for manual CID conversion.</p> <p>Requests for a content path sent to the gateway domain will return an HTTP 301 redirect to a correct subdomain version, taking care of any necessary encoding conversion if needed:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>https://&#x3C;gateway-host>.tld/ipfs/&#x3C;cid> -> https://&#x3C;cidv1>.ipfs.&#x3C;gateway-host>.tld/ </code></pre></div><p>For example, opening the CIDv0 resource at <a href="https://dweb.link/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Mars.html" target="_blank" rel="noopener noreferrer"><code>https://dweb.link/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Mars.html</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> returns a redirect to a CIDv1 representation at <a href="https://bafybeicgmdpvw4duutrmdxl4a7gc52sxyuk7nz5gby77afwdteh3jc5bqa.ipfs.dweb.link/wiki/Mars.html" target="_blank" rel="noopener noreferrer"><code>https://bafybeicgmdpvw4duutrmdxl4a7gc52sxyuk7nz5gby77afwdteh3jc5bqa.ipfs.dweb.link/wiki/Mars.html</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <p>The gateway converts the CID to case-insensitive encoding. The multihash in CIDv1 is the same as in the original CIDv0.</p> <h4 id="manual-use-cid-ipfs-io-or-the-command-line"><a href="#manual-use-cid-ipfs-io-or-the-command-line" class="header-anchor">#</a> Manual — use cid.ipfs.io or the command line</h4> <p>The conversion can also be done manually.</p> <p>To convert a CID to Base32 with no padding (<a href="https://datatracker.ietf.org/doc/html/rfc4648#section-6" target="_blank" rel="noopener noreferrer">RFC4648<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>), use <a href="https://cid.ipfs.io" target="_blank" rel="noopener noreferrer">cid.ipfs.io<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>, or the command line. Below is an example using the command line:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>ipfs cid base32 QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR </code></pre></div><p>The output of this is:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi </code></pre></div><p>PeerIDs can be represented as a <a href="https://github.com/libp2p/specs/blob/master/RFC/0001-text-peerid-cid.md" target="_blank" rel="noopener noreferrer">CID with <code>libp2p-key</code> multicodec<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>. Base36 is suggested as a safer default for longer keys:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>ipfs key list <span class="token parameter variable">-l</span> --ipns-base base36 k51qzi5uqu5dh9ihj4p2v5sl3hxvv27ryx2w0xrsv6jmmqi91t9xp8p9kaipc2 self ipfs cid <span class="token function">format</span> <span class="token parameter variable">-v</span> <span class="token number">1</span> <span class="token parameter variable">-b</span> base36 <span class="token parameter variable">--codec</span> libp2p-key QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN k2k4r8jl0yz8qjgqbmc2cdu5hkqek5rj6flgnlkyywynci20j0iuyfuj </code></pre></div><h2 id="dnslink-gateway"><a href="#dnslink-gateway" class="header-anchor">#</a> DNSLink gateway</h2> <p>The gateway provided by Kubo understands the <code>Host</code> header present in HTTP requests and will check if <a href="../../concepts/dnslink/">DNSLink</a> exists for a specified <a href="https://en.wikipedia.org/wiki/Fully_qualified_domain_name" target="_blank" rel="noopener noreferrer">domain name<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>. If DNSLink is present, the gateway will return content from a path resolved via DNS TXT record. This type of gateway provides full <a href="https://en.wikipedia.org/wiki/Same-origin_policy" target="_blank" rel="noopener noreferrer">origin isolation<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <p>An example is this website, <a href="https://docs.ipfs.tech" target="_blank" rel="noopener noreferrer">https://docs.ipfs.tech<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>For a complete DNSLink guide, including tutorials, usage examples, and FAQs, see <a href="https://dnslink.io" target="_blank" rel="noopener noreferrer">dnslink.io<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p></div> <h2 id="native-urls"><a href="#native-urls" class="header-anchor">#</a> Native URLs</h2> <p>The native address format is the same as a <a href="https://docs.ipfs.tech/how-to/address-ipfs-on-web/#subdomain-gateway" target="_blank" rel="noopener noreferrer">subdomain gateway<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> HTTP URL, but with two differences:</p> <ul><li>The protocol scheme is replaced by the <code>ipfs</code> or <code>ipns</code> namespace</li> <li>The location-based authority component (the gateway host and port) is replaced with a CID</li></ul> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>ipfs://{cid}/path/to/subresource/cat.jpg </code></pre></div><p>Examples:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>ipfs://{cidv1} ipfs://{cidv1}/path/to/resource ipfs://{cidv1}/path/to/resource?query=foo#fragment ipns://{cidv1-libp2p-key} ipns://{cidv1-libp2p-key}/path/to/resource ipns://{dnslink-name}/path/to/resource?query=foo#fragment </code></pre></div><div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>Our main goal here is to reuse existing standards that maximize interoperability with existing user-agents like browsers and CLI tools. If something is not clear, HTTP URL rules apply.</p></div> <p>The first element after the double slash is an identifier representing the content root. It is interpreted as an authority component used for origin calculation, which provides necessary isolation between security contexts of different content trees.</p> <p>Example:</p> <div class="language-plaintext extra-class"><pre class="language-plaintext"><code>ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html </code></pre></div><div class="custom-block warning"><p class="custom-block-title">Avoid case-sensitive CID</p> <p>Some user agents will force-lowercase the CID component of URL-like address. To ensure interoperability with existing libraries and software, use case-insensitive CID encoding. Use of CIDv1 in Base32 or Base36 is advised.</p></div> <h3 id="turning-native-address-to-a-canonical-content-path"><a href="#turning-native-address-to-a-canonical-content-path" class="header-anchor">#</a> Turning native address to a canonical content path</h3> <p>Every "URL" address can be turned back into a content path with ease:</p> <p>Examples:</p> <ul><li><code>ipfs://{immutable-root}/path/to/resourceA</code> converts to <code>/ipfs/{immutable-root}/path/to/resourceA</code></li> <li><code>ipns://{mutable-root}/path/to/resourceB</code> converts to <code>/ipns/{mutable-root}/path/to/resourceB</code></li></ul> <h2 id="further-resources"><a href="#further-resources" class="header-anchor">#</a> Further resources</h2> <h3 id="technical-specification-for-implementers"><a href="#technical-specification-for-implementers" class="header-anchor">#</a> Technical specification for implementers</h3> <p>See the <a href="https://github.com/ipfs/in-web-browsers/blob/master/ADDRESSING.md" target="_blank" rel="noopener noreferrer">IPFS in-web-browsers repository<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <h3 id="background-on-address-scheme-discussions"><a href="#background-on-address-scheme-discussions" class="header-anchor">#</a> Background on address scheme discussions</h3> <p>Discussions around IPFS addressing have been ongoing since <a href="https://github.com/jbenet" target="_blank" rel="noopener noreferrer">@jbenet<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> published the <a href="https://ipfs.io/ipfs/QmR7GSQM93Cx5eAg6a6yRzNde1FQv7uL6X1o4k7zrJa3LX/ipfs.draft3.pdf" target="_blank" rel="noopener noreferrer">IPFS whitepaper<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>, with a number of other approaches being proposed. This long-standing design discussion includes many lengthy GitHub issue threads, but a good summary can be found in <a href="https://github.com/ipfs/specs/pull/152" target="_blank" rel="noopener noreferrer">this PR<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <h3 id="ipfs-companion"><a href="#ipfs-companion" class="header-anchor">#</a> IPFS Companion</h3> <p><a href="https://github.com/ipfs/ipfs-companion#readme" target="_blank" rel="noopener noreferrer">IPFS Companion<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> is a browser extension that simplifies access to IPFS resources.</p> <p>It provides support for native URLs and will automatically redirect IPFS gateway requests to your local Kubo daemon so that you are not relying on or trusting remote gateways.</p></div> <div class="content-footer" data-v-b274761c=""><div class="feedback content-feedback" data-v-063e6196="" data-v-b274761c=""><h3 data-v-063e6196="">Was this information helpful?</h3> <div class="feedback-actions" data-v-063e6196=""><button title="Yes" class="btn btn-primary" data-v-063e6196=""> Yes </button> <button title="No" class="btn btn-primary" data-v-063e6196=""> No </button></div> <!----> <div class="feedback-edit-or-issue" data-v-063e6196=""><div class="local-page-edit" data-v-063e6196=""><div class="local-edit-link"><a href="https://github.com/ipfs/ipfs-docs/edit/main/docs/how-to/address-ipfs-on-web.md" target="_blank" rel="noopener noreferrer">Edit this page</a> <span> on GitHub or <a href="https://github.com/ipfs/ipfs-docs/issues/new?assignees=&#x26;labels=need%2Ftriage&#x26;template=open_an_issue.md&#x26;title=Address IPFS on the web" target="_blank" rel="noopener noreferrer">open an issue</a></span></div></div></div></div> <div class="legacy-callout" data-v-21e6796e="" data-v-b274761c=""><p data-v-21e6796e=""><b data-v-21e6796e="">Help us improve this site!</b></p> <section data-v-21e6796e=""><div class="block" data-v-21e6796e=""><ul data-v-21e6796e=""><li data-v-21e6796e=""><a href="https://github.com/ipfs/ipfs-docs/issues/new?assignees=&#x26;labels=OKR+3%3A+Content+Improvement%2C+docs-ipfs&#x26;template=content-request.md&#x26;title=%5BCONTENT+REQUEST%5D+%28add+your+title+here%21%29" target="_blank" rel="noopener noreferrer" data-v-21e6796e="">Suggest new content</a></li></ul></div> <div class="block" data-v-21e6796e=""><ul data-v-21e6796e=""><li data-v-21e6796e=""><a href="https://github.com/ipfs/ipfs-docs/issues/new?assignees=&#x26;labels=OKR+3%3A+Content+Improvement%2C+docs-ipfs&#x26;template=documentation-issue.md&#x26;title=%5BDOCS+ISSUE%5D+%28add+your+title+here%21%29" target="_blank" rel="noopener noreferrer" data-v-21e6796e="">Give general feedback</a></li></ul></div></section></div> <footer class="page-edit" data-v-b274761c=""><!----> <!----></footer> <!----></div> <div data-v-b274761c=""></div> <div data-v-b274761c=""></div> </main></div><div class="global-ui"><!----><vuecustomtooltip></vuecustomtooltip><div></div></div></div> <script src="../../assets/js/app.576e9eab.js" defer></script><script src="../../assets/js/2.4d957bfb.js" defer></script><script src="../../assets/js/1.e5bd4a62.js" defer></script><script src="../../assets/js/88.232e42ef.js" defer></script> </body></html>

Pages: 1 2 3 4 5 6 7 8 9 10