Skip to content

Commit

Permalink
fix(gateway): remove handleUnsupportedHeaders after go-ipfs 0.13 (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias authored Jun 14, 2023
1 parent d84014d commit abced78
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions gateway/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ func (i *handler) getOrHeadHandler(w http.ResponseWriter, r *http.Request) {
logger := log.With("from", r.RequestURI)
logger.Debug("http request received")

if i.handleUnsupportedHeaders(w, r) ||
handleProtocolHandlerRedirect(w, r, i.config) ||
if handleProtocolHandlerRedirect(w, r, i.config) ||
i.handleServiceWorkerRegistration(w, r) ||
handleIpnsB58mhToCidRedirection(w, r) {
return
Expand Down Expand Up @@ -760,17 +759,6 @@ func (i *handler) handleOnlyIfCached(w http.ResponseWriter, r *http.Request, con
return false
}

func (i *handler) handleUnsupportedHeaders(w http.ResponseWriter, r *http.Request) bool {
// X-Ipfs-Gateway-Prefix was removed (https://github.com/ipfs/kubo/issues/7702)
// TODO: remove this after go-ipfs 0.13 ships
if prfx := r.Header.Get("X-Ipfs-Gateway-Prefix"); prfx != "" {
err := fmt.Errorf("unsupported HTTP header: X-Ipfs-Gateway-Prefix support was removed: https://github.com/ipfs/kubo/issues/7702")
i.webError(w, r, err, http.StatusBadRequest)
return true
}
return false
}

// ?uri query param support for requests produced by web browsers
// via navigator.registerProtocolHandler Web API
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
Expand Down

0 comments on commit abced78

Please sign in to comment.