Skip to content

Commit 9cb73c1

Browse files
committed
feat: protect IPFS WebUI and RPC API with basic auth
1 parent c5e3853 commit 9cb73c1

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

nginx/enode.conf.template

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,36 @@ server {
4444
proxy_set_header X-Real-IP $remote_addr;
4545
}
4646

47+
# IPFS WebUI CID (protected with basic auth)
48+
location /ipfs/bafybeidsjptidvb6wf6benznq2pxgnt5iyksgtecpmjoimlmswhtx2u5ua {
49+
auth_basic "IPFS Admin";
50+
auth_basic_user_file /etc/nginx/.htpasswd;
51+
52+
proxy_pass http://ipfs_gateway/ipfs/bafybeidsjptidvb6wf6benznq2pxgnt5iyksgtecpmjoimlmswhtx2u5ua;
53+
proxy_set_header Host $host;
54+
proxy_set_header X-Real-IP $remote_addr;
55+
}
56+
57+
# IPFS RPC API (protected with basic auth, for WebUI access)
58+
location /api/v0 {
59+
auth_basic "IPFS Admin";
60+
auth_basic_user_file /etc/nginx/.htpasswd;
61+
62+
proxy_pass http://ipfs_api/api/v0;
63+
proxy_set_header Host $host;
64+
proxy_set_header X-Real-IP $remote_addr;
65+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
66+
proxy_set_header X-Forwarded-Proto $scheme;
67+
68+
proxy_http_version 1.1;
69+
proxy_buffering off;
70+
proxy_request_buffering off;
71+
72+
proxy_connect_timeout 300s;
73+
proxy_send_timeout 300s;
74+
proxy_read_timeout 300s;
75+
}
76+
4777
# IPFS WebUI & API (protected with basic auth)
4878
location /ipfs-admin/ {
4979
auth_basic "IPFS Admin";

0 commit comments

Comments
 (0)