docs: define Gateway.PathPrefixes
adds docs for Gateway.PathPrefixes. Taken from great commit notes by @lgierth (thank you!) https://github.com/ipfs/go-ipfs/commit/09937f84b64212896e1d80147f828d86ebc19d68
Oli Evans committed
Jan 15, 2020 at 14:32 UTC
0eba53bd987c8f377b7c4ff766fefb626eaca314
1 file changed
+21
-1
docs/config.md
+21
-1
@@ -294,7 +294,27 @@ A boolean to configure whether the gateway is writeable or not.
294
Default: `false`
295
296
- `PathPrefixes`
297
-TODO
297
+Array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix header.
298
+
299
+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.
300
+
301
+Example: We mount `blog.ipfs.io` (a dnslink page) at `ipfs.io/blog`.
302
+
303
+**.ipfs/config**
304
+```json
305
+"Gateway": {
306
+ "PathPrefixes": ["/blog"],
307
+```
308
+
309
+**nginx_ipfs.conf**
310
+```nginx
311
+location /blog/ {
312
+ rewrite "^/blog(/.*)$" $1 break;
313
+ proxy_set_header Host blog.ipfs.io;
314
+ proxy_set_header X-Ipfs-Gateway-Prefix /blog;
315
+ proxy_pass http://127.0.0.1:8080;
316
+}
317
+```
318
319
Default: `[]`
320