fix(module,app): handle hosts without port
arcad/emissary/pipeline/head There was a failure building this commit Details

This commit is contained in:
wpetit 2023-04-06 10:21:52 +02:00
parent 2e1ee44e6a
commit 06b1235707
1 changed files with 1 additions and 4 deletions

View File

@ -202,10 +202,7 @@ func unexpectedHostRedirect(hostTarget string, acceptedHostPatterns ...string) f
fn := func(w http.ResponseWriter, r *http.Request) { fn := func(w http.ResponseWriter, r *http.Request) {
host, port, err := net.SplitHostPort(r.Host) host, port, err := net.SplitHostPort(r.Host)
if err != nil { if err != nil {
logger.Error(r.Context(), "could not split host/port", logger.E(errors.WithStack(err))) host = r.Host
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
} }
matched := wildcard.MatchAny(host, acceptedHostPatterns...) matched := wildcard.MatchAny(host, acceptedHostPatterns...)