Skip to content

Commit

Permalink
Merge pull request #67 from nlnwa/fix-relative-location-header
Browse files Browse the repository at this point in the history
Fix URL parsing in redirect handling
  • Loading branch information
andrbo authored Aug 31, 2022
2 parents 9395a25 + 8a1faa3 commit c287f15
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/server/warcserver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,11 @@ func (h Handler) resource(w http.ResponseWriter, r *http.Request) {
scheme = "https"
}
host := r.Host
u, err := url.Parse(scheme + "://" + host)
u, err := url.Parse(scheme + "://" + host + path)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
u.SetPathname(path)

handlers.RenderRedirect(w, u.String())
} else {
Expand Down

0 comments on commit c287f15

Please sign in to comment.