authenticate: fix internal url with webauthn (#3194)

This commit is contained in:
Caleb Doxsey 2022-03-28 06:36:48 -06:00 committed by GitHub
parent 8d000cea3b
commit 69ba511c64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 31 deletions

View file

@ -46,18 +46,5 @@ func (a *Authenticate) getExternalRequest(r *http.Request) *http.Request {
return r
}
// if we're not using a different internal URL there's nothing to do
if externalURL.String() == internalURL.String() {
return r
}
// replace the internal host with the external host
er := r.Clone(r.Context())
if er.URL.Host == internalURL.Host {
er.URL.Host = externalURL.Host
}
if er.Host == internalURL.Host {
er.Host = externalURL.Host
}
return er
return urlutil.GetExternalRequest(internalURL, externalURL, r)
}