Merge pull request #431 from ploxiln/nil_upstream_url

gracefully report un-parsed upstream URL
This commit is contained in:
Jehiah Czebotar 2017-08-28 20:46:30 -04:00 committed by GitHub
commit 23cef89236

View File

@ -131,7 +131,8 @@ func (o *Options) Validate() error {
msgs = append(msgs, "missing setting: client-secret")
}
if o.AuthenticatedEmailsFile == "" && len(o.EmailDomains) == 0 && o.HtpasswdFile == "" {
msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required.\n use email-domain=* to authorize all email addresses")
msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required."+
"\n use email-domain=* to authorize all email addresses")
}
o.redirectURL, msgs = parseURL(o.RedirectURL, "redirect", msgs)
@ -139,14 +140,13 @@ func (o *Options) Validate() error {
for _, u := range o.Upstreams {
upstreamURL, err := url.Parse(u)
if err != nil {
msgs = append(msgs, fmt.Sprintf(
"error parsing upstream=%q %s",
upstreamURL, err))
msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
} else {
if upstreamURL.Path == "" {
upstreamURL.Path = "/"
}
o.proxyURLs = append(o.proxyURLs, upstreamURL)
}
if upstreamURL.Path == "" {
upstreamURL.Path = "/"
}
o.proxyURLs = append(o.proxyURLs, upstreamURL)
}
for _, u := range o.SkipAuthRegex {