Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gateway): remove warning about X-Ipfs-Gateway-Prefix #350

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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