Skip to content

Commit

Permalink
fix: properly handle relative redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravy committed Jul 4, 2022
1 parent 74e9a42 commit e40aec2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/handler/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class RedirectHandler {
return this.handler.onHeaders(statusCode, headers, resume, statusText)
}

const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin))
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)))
const path = search ? `${pathname}${search}` : pathname

// Remove headers referring to the original URL.
Expand Down

0 comments on commit e40aec2

Please sign in to comment.