Skip to content

Commit

Permalink
Remove X-IPFS-ID header
Browse files Browse the repository at this point in the history
Reason: #4 (comment)
  • Loading branch information
makew0rld committed May 9, 2022
1 parent 6fcf4ee commit 4888f68
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
4 changes: 0 additions & 4 deletions go-ipfs/core/corehttp/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()))
}

}
Expand Down
7 changes: 1 addition & 6 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

```
Expand All @@ -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/<topic>`

Expand Down

0 comments on commit 4888f68

Please sign in to comment.