docs: define Gateway.PathPrefixes

adds docs for Gateway.PathPrefixes. Taken from great commit notes by @lgierth (thank you!) 09937f84b6
This commit is contained in:
Oli Evans 2020-01-15 14:32:05 +00:00 committed by GitHub
parent 8a16b8704b
commit 0eba53bd98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -294,7 +294,27 @@ A boolean to configure whether the gateway is writeable or not.
Default: `false`
- `PathPrefixes`
TODO
Array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix header.
The X-Ipfs-Path-Prefix header is used to specify a base path to prepend to links in directory listings and for trailing-slash redirects. It is intended to be set by a frontend http proxy like nginx.
Example: We mount `blog.ipfs.io` (a dnslink page) at `ipfs.io/blog`.
**.ipfs/config**
```json
"Gateway": {
"PathPrefixes": ["/blog"],
```
**nginx_ipfs.conf**
```nginx
location /blog/ {
rewrite "^/blog(/.*)$" $1 break;
proxy_set_header Host blog.ipfs.io;
proxy_set_header X-Ipfs-Gateway-Prefix /blog;
proxy_pass http://127.0.0.1:8080;
}
```
Default: `[]`