From 5162182252b6d6095cad290f0fb1cadf9fc041ed Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 14 Jun 2023 13:16:07 +0200 Subject: [PATCH] feat(gateway): remove handleUnsupportHeaders after go-ipfs 0.13 --- gateway/handler.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/gateway/handler.go b/gateway/handler.go index eba593e53..89c64a983 100644 --- a/gateway/handler.go +++ b/gateway/handler.go @@ -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 @@ -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