diff --git a/CHANGELOG.md b/CHANGELOG.md index 2926a0a56..8fb87157e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The following emojis are used to highlight certain changes: ## [Unreleased] +* ❔ Allows redirects of URLs by query parameter (in addition to path). A `_redirects` file containing `/from type=:type /to/:type.html 200` will respond to a request of `/from?type=thing` with `/to/thing.html`. + ### Added ### Changed diff --git a/gateway/handler_unixfs__redirects.go b/gateway/handler_unixfs__redirects.go index a96b87d36..afb7859ca 100644 --- a/gateway/handler_unixfs__redirects.go +++ b/gateway/handler_unixfs__redirects.go @@ -99,7 +99,7 @@ func (i *handler) handleRedirectsFileRules(w http.ResponseWriter, r *http.Reques for _, rule := range redirectRules { // Error right away if the rule is invalid - if !rule.MatchAndExpandPlaceholders(urlPath) { + if !rule.MatchAndExpandPlaceholders(urlPath, r.URL.Query()) { continue }