From 4888f68a065547a1b4185e02a31d97b5e7a5257e Mon Sep 17 00:00:00 2001 From: makeworld Date: Mon, 9 May 2022 16:49:19 -0400 Subject: [PATCH] Remove X-IPFS-ID header Reason: https://github.com/AgregoreWeb/agregore-ipfs-daemon/pull/4#discussion_r867204134 --- gateway/gateway.go | 2 +- go-ipfs/core/corehttp/pubsub.go | 4 ---- spec.md | 7 +------ 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/gateway/gateway.go b/gateway/gateway.go index 5dba03c..a6c618a 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -111,7 +111,7 @@ func setupConfig(cfg *config.Config, gatewayPort string) { cfg.Gateway.HTTPHeaders = make(map[string][]string) cfg.Gateway.HTTPHeaders["Access-Control-Allow-Methods"] = []string{"GET", "HEAD", "POST", "PUT", "DELETE"} cfg.Gateway.HTTPHeaders["Access-Control-Allow-Headers"] = []string{"X-IPFS-Pin"} - cfg.Gateway.HTTPHeaders["Access-Control-Expose-Headers"] = []string{"IPFS-Hash", "X-IPFS-Path", "X-IPNS-Path", "Etag", "X-IPFS-ID"} + cfg.Gateway.HTTPHeaders["Access-Control-Expose-Headers"] = []string{"IPFS-Hash", "X-IPFS-Path", "X-IPNS-Path", "Etag"} cfg.Gateway.HTTPHeaders["Access-Control-Max-Age"] = []string{"86400"} if runtime.GOOS == "android" { diff --git a/go-ipfs/core/corehttp/pubsub.go b/go-ipfs/core/corehttp/pubsub.go index a103a3d..ce8dd17 100644 --- a/go-ipfs/core/corehttp/pubsub.go +++ b/go-ipfs/core/corehttp/pubsub.go @@ -36,7 +36,6 @@ const ( func (i *gatewayHandler) pubsubHeadHandler(w http.ResponseWriter, r *http.Request) { i.addUserHeaders(w) - w.Header().Set("X-IPFS-ID", i.id.Pretty()) } type pubSubInfo struct { @@ -165,9 +164,6 @@ func (i *gatewayHandler) setupPubsubHeaders() { i.headerBytes = append(i.headerBytes, []byte(fmt.Sprintf("%s: %s", header, vals[j]))) } } - // Add custom header providing the node's own ID, so pubsub messages from - // itself can be filtered - i.headerBytes = append(i.headerBytes, []byte("X-IPFS-ID: "+i.id.Pretty())) } } diff --git a/spec.md b/spec.md index e694192..4108eee 100644 --- a/spec.md +++ b/spec.md @@ -71,7 +71,6 @@ Access-Control-Expose-Headers: X-Chunked-Output Access-Control-Expose-Headers: X-Ipfs-Path Access-Control-Expose-Headers: X-Ipns-Path Access-Control-Expose-Headers: X-Stream-Output -Access-Control-Expose-Headers: X-Ipfs-Id ``` ## CIDs @@ -268,8 +267,6 @@ In the JSON: `from` is the prettified ID of the node who sent the message, `data In the JSON, `data` is either a JSON object, a string, or bytes base64-encoded into a string. This behaviour depends on the format parameter mentioned above. -The response also contains the header `X-IPFS-ID` which is this node's prettified ID. This allows the client to filter out pubsub messages that come from itself. - Errors are also sent as events in the stream: ``` @@ -286,9 +283,7 @@ data: not valid UTF-8 ### HEAD `/pubsub/<...>` -This will return the same headers as any GET pubsub request. The header that might be useful is `X-IPFS-ID`, described above. - -This API call will work on `/pubsub/` and any path below it, and will always return the same headers. +This will return the same headers as any GET pubsub request. This API call will work on `/pubsub/` and any path below it, and will always return the same headers. ### POST `/pubsub/`