Skip to content
Open
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d5673ca
Add INTEGRATION document
markg85 May 12, 2022
9630240
Update INTEGRATION.md
markg85 Nov 21, 2022
b23caf5
Merge branch 'ipfs:main' into master
markg85 Nov 21, 2022
f956141
rewrote integration document
markg85 Nov 26, 2022
8a65c2c
Remove drawio files, we're using mermaid now
markg85 Nov 26, 2022
0e8fa0d
follow the template
markg85 Nov 26, 2022
81adfd0
linter fixes
markg85 Nov 26, 2022
ed0fe22
a few more linter fixes
markg85 Nov 26, 2022
0d6b8d6
wip image instead
markg85 Nov 28, 2022
0dd13f2
review feedback and updated to new concepts
markg85 Nov 29, 2022
d362c62
Refer to the new file as gateways (plural).
markg85 Nov 29, 2022
7ce0432
Move integrations document to:
markg85 Dec 8, 2022
9e5cd95
template fixes
markg85 Dec 8, 2022
4d80040
280. Not 180.
markg85 Dec 8, 2022
50b70cf
Add global configuration details
markg85 Dec 11, 2022
c6699f7
Little less bold
markg85 Dec 11, 2022
32b1cfd
Reword the compatibility section and fix some review feedback.
markg85 Sep 25, 2023
3990b3d
Merge branch 'main' into master
markg85 Sep 25, 2023
72cdde2
Merge origin/main into markg85-master
lidel Oct 3, 2023
6ee4e19
ipip-280: update and split into specs and ipip
lidel Oct 3, 2023
6290ead
fix: typos and clarify file encoding
lidel Dec 16, 2025
85702ce
fix: clarify single vs multiple URL handling in gateway file
lidel Dec 16, 2025
9d0024f
Merge remote-tracking branch 'origin/main' into pr-280
lidel Dec 16, 2025
e657c46
docs: document out-of-scope alternatives
lidel Dec 16, 2025
a5334ca
fix: remove stray word in curl section
lidel Dec 16, 2025
c65d0a6
fix: simplify and fix OS-specific path handling
lidel Dec 16, 2025
65e6099
chore: update metadata and relax MUST to SHOULD
lidel Dec 16, 2025
7acc773
fix: clarify gateway URL requirements
lidel Dec 16, 2025
e8581ce
fix: capitalize SHOULD for RFC 2119 consistency
lidel Dec 16, 2025
81e97eb
chore: add libp2p-gateway to integratingHttpGateways
lidel Dec 16, 2025
22779d6
chore: mark IPIP as ratified (implemented since 2022)
lidel Dec 16, 2025
b4e73a2
docs: add official ffmpeg docs reference
lidel Dec 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions integrations/GATEWAYS_FILE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# IPIP 0280: Gateways file
- Start Date: 2022-12-08
- Related Issues:
- https://github.com/ipfs/kubo/issues/8847

## Summary

Defines how IPFS implementations must expose their gateway. This only affects the file-based method of exposiing a gateway.
Comment thread
markg85 marked this conversation as resolved.
Outdated

## Motivation

Applications wanting to use IPFS resources are, without this spec, left to invent their own ways of finding a gateway. This spec defines how an application wanting to implement IPFS support can find a list of gateways.

Users should be aware that this is just a list of gateways. It could contain a local gateway but doesn't have to. It's up to the user to do filtering on that list to find an actual local gateway.

## Detailed design

This integration spec defines the recommended way for IPFS implementations to expose the gateway they host for IPFS integrations (think applications wanting to support IPFS) to find and use said gateways.

An IPFS implementation must expose the gateway it serves in a file called `gateways` (more on where this file is located in the section below). The gateway must be exposed as a single line in the following format:
Comment thread
markg85 marked this conversation as resolved.
Outdated

`http://<ip>:<port>`

In case the `gateways` file already exists, this line must be **prepended** with the rest of the data left as-is. This is a soft guarantee that any locally running gateways are at the top of the list. In any other case the `gateways` file must be created and the `gateway` line inserted to it as one line terminated with `\r\n`.

Upon shutdown of the IPFS implementation it is to remove it's specific gateway line from the `gateways` file and leave no gaps. It must take care potential empty lines and leave a file behind with the remaning gateways each on a single line and terminated - per line - with `\r\n`.

### Gateways file placement

As a reference, [this](https://github.com/cjbassi/platform-dirs-rs#path-list) list of configuration folders is used.

| | with variables | full paths |
| -------- | -------- | -------- |
| (user) Windows | %APPDATA%/ipfs | C:/Users/%USERNAME%/AppData/Roaming/ipfs |
| (global) Windows | %PROGRAMDATA%/ipfs | C:/ProgramData/ipfs |
| (user) macOS | $XDG_CONFIG_HOME/ipfs | ~/Library/Application Support/ipfs |
| (global) macOS | N/A | /Library/Application Support/ipfs |
| (user) Linux | $XDG_CONFIG_HOME/ipfs | ~/.config/ipfs |
| (global) Linux | N/A | /etc/ipfs |
Comment thread
markg85 marked this conversation as resolved.
Outdated

The `gateways` file must be placed in the folder appropiate for the platform the IPFS implementation instance is running on. For linux that would be `~/.config/ipfs/gateways` or `$XDG_CONFIG_HOME/ipfs/gateways`
Comment thread
markg85 marked this conversation as resolved.
Outdated

The file will be created when it doesn't exist.
It will never be delated! This means the file will exist and be empty when an IPFS implementation removes it's own gateway from that file and if that gateway was the only line in the file.
Comment thread
markg85 marked this conversation as resolved.
Outdated

Creating and updating the `gateways` file only applies to the `(user)` prefixed file. The `(global)` prefixed file will not be written to by the IPFS implementation!

#### Local file
The local file is for read-write access for the IPFS implementation.

#### Global file
Comment thread
lidel marked this conversation as resolved.
Outdated
If the local file cannot be found or is empty then the IPFS implementation should try to read the global config file and read it's gateway values instead. This global file must not be changed by any IPFS implementation!

## Test fixtures

N/A

## Design rationale

To simplify IPFS integrations in third party applications it's important to know if said application can use a gateway. This spec defines the rules to find such a gateway and/or how to influence it.

### User benefit

Users, applications using IPFS, get a defined way to find gateways to use. Without this spec there is no defined way.

### Compatibility

This is only applicable to Kubo! Other IPFS implementations are to ignore this
Comment thread
markg85 marked this conversation as resolved.
Outdated

The legacy gateway file (placed in `~/.ipfs/gateway`) was made up as a response to a need to know which gateway an IPFS node would expose. While that file itself was never specced out, it served the need. Some applications are using this file therefore the file has to be maintained for the Kubo reference implemenation. Any other IPFS implementation should ignore this.

The file only contains a single line being the http gateway url. For example: "http://localhost:8080".

The file conditions:
1. is named "gateway"
2. only exists when Kubo starts a gateway
3. is removed when Kubo shuts down

Future Kubo implemenations will do the above via symlinking the `gateways` file to `gateway` while maintaining the same rules as stated above.

### Security

N/A

### Alternatives

There are no alternatives I'm aware of. There is [this](https://github.com/ipfs/kubo/issues/8847) issue that predates this very IPIP but also serves as starting block to this IPIP.

### Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).