Overcome public IPFS gateway limitations, such as 429 Too Many Requests, by hosting your own IPFS Gateway and HTTP Proxy.
git clone https://github.com/o-az/eyepfs.git
docker buildx build . \
--progress 'plain' \
--file 'Dockerfile' \
--platform 'linux/amd64' \
--tag 'ipfs_gateway_proxy'
# or `make docker-build`
docker run \
--rm \
-it \
--name 'ipfs_gateway_proxy' \
--env IPFS_GATEWAY_HOST='http://127.0.0.1:8080' \
--env ALLOW_ORIGINS='*' \
--publish '3031:3031' \
--platform 'linux/amd64' \
'ipfs_gateway_proxy'
# or `make docker-run`
note: btw it may need a few seconds if it's your first time, no more than 6. So if request fail, just retry
Open this in browser: http://127.0.0.1:3031/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
or run this:
curl --location --request GET \
--url 'http://127.0.0.1:3031/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi' \
--output '/tmp/ipfs_proxy_image.jpeg' && \
stat '/tmp/ipfs_proxy_image.jpeg'
Restricting access to your gateway is as simple as setting ALLOW_ORIGINS
to a comma separated list of allowed origins. Example:
docker run \
--rm \
-it \
--name 'ipfs_gateway_proxy' \
--env IPFS_GATEWAY_HOST='http://127.0.0.1:8080' \
--env ALLOW_ORIGINS='http://example.com,http://example.org' \
--publish '3031:3031' \
'ipfs_gateway_proxy'
anywhere that can run a Dockerfile
🐳
RAILWAY_DOCKERFILE_PATH=Dockerfile railway up --service 'api' --detach --environment 'production'
fly deploy --app='ipfs_gateway' --dockerfile Dockerfile --remote-only --detach --build-arg PORT=3031 --env IPFS_PROFILE='server' --env IPFS_GATEWAY_HOST='http://127.0.0.1:8080' --env ALLOW_ORIGINS='*'
- 🔨 (
CORS
) configuration, - (
Kubo
) disable all methods butGET
andHEAD
, andOPTIONS
for CORS, - (
Kubo
) setSwarm#ConnMgr#Type
to"none"
(disable all swarm connections), - (
CI
) workflow publish image to Docker Hub & GitHub Container Registry, - (
CI
) Generate a simple performance report on push, - Got any ideas? Let's chat
If an item has 🔨 it means it's configurable through env variables