You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/how-to/address-ipfs-on-web.md
+27-14
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,7 @@ HTTP gateways have worked well since 2015, but they come with a significant set
30
30
31
31
Tools and browser extensions should detect IPFS content paths and resolve them directly over IPFS protocol. They should use HTTP gateway only as a fallback when no native implementation is available in order to ensure a smooth, backward-compatible transition.
32
32
33
-
### Gateway types
34
-
35
-
#### Path gateway
33
+
### Path gateway
36
34
37
35
In the most basic 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 as relative to the current server and just work without a need for any conversion:
In this scheme, all pages share a <ahref="https://en.wikipedia.org/wiki/Same-origin_policy"target="_blank">single Origin <iclass="fas fa-external-link-square-alt fa-sm"></i></a>, which means this type of gateway should be used when site isolation does not matter.
46
-
</aside>
42
+
::: danger
43
+
In this scheme, all pages share a <ahref="https://en.wikipedia.org/wiki/Same-origin_policy"target="_blank">single Origin <iclass="fas fa-external-link-square-alt fa-sm"></i></a>, which means this type of gateway should be used only when site isolation does not matter (static content without cookies, local storage or Web APIs that require user permission).
44
+
45
+
When in doubt, use subdomain gateway instead (see below).
When [origin-based security](https://en.wikipedia.org/wiki/Same-origin_policy) perimeter is needed, [CIDv1](https://github.com/ipld/cid#cidv1) in Base32 ([RFC4648](https://tools.ietf.org/html/rfc4648#section-6), no padding) should be used in the subdomain:
Right now, this type of gateway requires additional configuration (<ahref="https://github.com/ipfs/infra/issues/81#issuecomment-461045160"target="_blank">example for Nginx <iclass="fas fa-external-link-square-alt fa-sm"></i></a>); however, there is ongoing work to <ahref="https://github.com/ipfs/go-ipfs/issues/5982"target="_blank">add native support in the IPFS daemon <iclass="fas fa-external-link-square-alt fa-sm"></i></a>.
69
-
</aside>
67
+
::: tip
68
+
69
+
For now, this type of gateway requires additional reverse proxy configuration.
70
+
As a reference, Nginx config for subdomain gateway at <code>dweb.link</code> is:
71
+
72
+
```nginx
73
+
if ($http_host ~ ^(.+)\.(ipfs|ipns)\.dweb\.link$) {
74
+
set $ipfspath /$2/$1;
75
+
rewrite "^(.*)$" $ipfspath$1 last;
76
+
}
77
+
```
78
+
79
+
There is ongoing work to <ahref="https://github.com/ipfs/go-ipfs/issues/6498"target="_blank">add native subdomain support to the IPFS daemon <iclass="fas fa-external-link-square-alt fa-sm"></i></a> which will simplify setup and remove the need for path translation at reverse proxy.
80
+
:::
70
81
71
-
####DNSLink gateway
82
+
### DNSLink gateway
72
83
73
84
The gateway provided by the IPFS daemon understands the `Host` header present in HTTP requests, and will check if [DNSLink](/guides/concepts/dnslink) exists for a specified [domain name](https://en.wikipedia.org/wiki/Fully_qualified_domain_name).
74
85
If DNSLink is present, the gateway will return content from a path resolved via DNS TXT record.
75
86
This type of gateway provides full [origin isolation](https://en.wikipedia.org/wiki/Same-origin_policy).
Support for case-insensitive IPNS roots is a <ahref="https://github.com/ipfs/go-ipfs/issues/5287"target="_blank">work in progress <iclass="fas fa-external-link-square-alt fa-sm"></i></a>.
104
-
</aside>
115
+
::: tip
116
+
Support for case-insensitive IPNS roots is a <ahref="https://github.com/ipfs/go-ipfs/issues/5287"target="_blank">work in progress <iclass="fas fa-external-link-square-alt fa-sm"></i></a>.
0 commit comments